Bota assim no creaturescripts:
function onCombat(cid, target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid, 123456) == 1 then return false end
end
return true
end
function onTarget(cid,target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid,123456) == 1 then
doPlayerSendCancel(cid, "Reative o PVP para atacar um jogador.")
return false
end
end
return true
end
function onLogin(cid)
registerCreatureEvent(cid, "PVPTarget")
registerCreatureEvent(cid, "PVPCombat")
return true
end
No xml coloca essas TAGs:
<event type="login" name="PVPLogin" event="script" value="script.lua"/>
<event type="target" name="PVPTarget" event="script" value="script.lua"/>
<event type="combat" name="PVPCombat" event="script" value="script.lua"/>
No talkactions coloca assim:
function onSay(cid, words, param, channel)
if param == "" then
return doPlayerSendCancel(cid, "Escolha se quer deixar o PVP on ou off.")
end
if isInArray({"on","off"}, param) then
local value = param == "on" and 1 or 0
local status = param == "on" and "ativou" or "desativou"
doPlayerSetStorageValue(cid, 123456, value)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você "..status.." o PVP.")
else
doPlayerSendCancel(cid, "Escolha se quer deixar o PVP on ou off.")
end
return true
end
A TAG vc coloca como quiser