Ir para conteúdo

Pvp System Control


Posts Recomendados

Muito interessante , mas se o player pode utilizar o comando com battle ficaria bem feio . rs

 

mas quem disse que pode?

 

 if isPlayerPzLocked(cid) == FALSE and isInArray({SKULL_NONE,SKULL_YELLOW}, getCreatureSkullType(cid)) then

 

faz checar essa função.

Editado por Vodkart
Link para o comentário
Compartilhar em outros sites

Teria como faze ele pro npc ativar e desativar o PVP?

Cobrando uma taxa de 100k pra ativa e de 300 pra desativa sendo que so pode desativar 1 semana depois.

E que precise de lvl 100+

 

wtf?

uma semana é muito tempo cara.

Link para o comentário
Compartilhar em outros sites

Teria como faze ele pro npc ativar e desativar o PVP?

Cobrando uma taxa de 100k pra ativa e de 300 pra desativa sendo que so pode desativar 1 semana depois.

E que precise de lvl 100+

 

 

Mods:

<?xml version="1.0" encoding="UTF-8"?>  
<mod name="Pvp Mode" version="1.0" author="Gevox" contact="xtibia.com" enabled="yes">  
<config name="pvpmode_func"><![CDATA[
function getPlayerPVPMode(cid)
local check = db.getResult("SELECT `pvpmode` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
return check:getDataInt("pvpmode") <= 0 and 0 or check:getDataInt("pvpmode") 
end
function setPlayerPVPMode(cid, value)
db.executeQuery("UPDATE `players` SET `pvpmode` = "..value.." WHERE `id` = "..getPlayerGUID(cid)) 
end
]]></config>
<event type="login" name="PvpModeRegister" event="script"><![CDATA[
domodlib('pvpmode_func')
function onLogin(cid)
registerCreatureEvent(cid, "pvpProtection")
if getPlayerPVPMode(cid) == 1 then doCreatureSetSkullType(cid, 1) end
   return true
   end]]></event>       
<event type="combat" name="pvpProtection" event="script"><![CDATA[
domodlib('pvpmode_func')
if isPlayer(cid) and isPlayer(target) then
if getPlayerPVPMode(cid) == 1 or getPlayerPVPMode(target) == 1 then
doPlayerSendCancel(cid, "You may not attack this player.")
return false
end
end
return true
]]></event>
</mod>

 

npc:

 

domodlib('pvpmode_func')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
local config = {
price = {[0] = 100000,[1] = 300000},
level = 100,
days = 7,
storage = 321523
}
if isInArray({"change","trocar", "pvp", "pk"}, msg) then
npcHandler:say("You want "..(getPlayerPVPMode(cid) == 0 and "enable" or "disable").." your pvp now for "..config.price[getPlayerPVPMode(cid)].." gp(s)? {yes}", cid)
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerLevel(cid) >= config.level then
if getPlayerStorageValue(cid,config.storage) <= os.time() then
if doPlayerRemoveMoney(cid, config.price[getPlayerPVPMode(cid)]) then 
setPlayerPVPMode(cid, getPlayerPVPMode(cid) == 0 and 1 or 0)
doCreatureSetSkullType(cid, getPlayerPVPMode(cid) == 1 and 1 or 0)
setPlayerStorageValue(cid, config.storage, os.time()+config.days*86400)
npcHandler:say("Now you set pvp mode to "..(getPlayerPVPMode(cid) == 0 and "off" or "on")..".", cid)
else
npcHandler:say("Sorry, You don't have money!", cid)
talkState[talkUser] = 0
end
else
npcHandler:say("Sorry, but you must wait until "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,config.storage)).." to change your pvp again!", cid)
talkState[talkUser] = 0
end
else
npcHandler:say("Sorry, You need level "..config.level.." or more to change your pvp!", cid)
talkState[talkUser] = 0
end
elseif isInArray({"no","nao"}, msg)  then  
selfSay("Then not.", cid)  
talkState[talkUser] = 0  
npcHandler:releaseFocus(cid)  
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 1 year later...
×
×
  • Criar Novo...