open data/creaturescripts/creaturescripts.xml
paste this:
XML:
<event type="attack" name="lvlrestriction" event="script" value="lvlrestriction.lua"/>
open data/creaturescripts/scripts/ and create lvlrestriction.lua
paste this in it:
LUA:
function onAttack(cid, target)
local dif = 20 -- lvl of difference
local lvlc = getPlayerLevel(cid)
local lvlt = getPlayerLevel(target)
if lvlc + dif >= lvlt and lvlc - dif <= lvlt then
return true
else
return false
end
end
open data/creaturescripts/scripts/login.lua
paste this :
LUA:
registerCreatureEvent(cid, "lvlrestriction")
that should be it
Hope it works! i havent tested, if it has any console error paste it here, if it doesnt work but doesnt have any error then the problem is in the "return" part xd
i guess it should work but you never know xD