Hi Guys. Im searching pvp protection script, which players with for example 50-149, can not attack players with 150+. I've got something like that, but it doesn't work. Do you have any idea^^?
local stages = {
{ from = 50, to = 149 },
{ from = 150, to = 350},
{ from = 350, to = 999}
}
function onCombat(cid, target)
local level = getPlayerLevel(cid)
if isPlayer(target) == TRUE then
local target_level = getPlayerLevel(target)
for i = 1, #stages do
if level >= stages.from and level <= stages.to then
if target_level >= stages.from and target_level <= stages.to then
return TRUE
else
doPlayerSendCancel(cid, "You are not allowed to attack this Player.")
end
end
end
local stages = {
{ from = 50, to = 149 },
{ from = 150, to = 350},
{ from = 350, to = 999}
}
function onCombat(cid, target)
local level = getPlayerLevel(cid)
if isPlayer(target) == TRUE then
local target_level = getPlayerLevel(target)
for i = 1, #stages do
if level >= stages.from and level <= stages.to then
if target_level >= stages.from and target_level <= stages.to then
return TRUE
else
doPlayerSendCancel(cid, "You are not allowed to attack this Player.")
end
end
end