Uhm this has been done a million times over AFAIK but someone requested something like it, just thought I'd put it here incase anyone was silently looking for it. It's a simple level protection script, most of its explained in the script itself. If you don't know how to install it then you probably shouldn't be here.
Code:
[FONT=Courier New][COLOR=#008000][I]--LEVEL_THRESHOLD is how many levels your victim can be away from your own level
--Example: Threshold of 10 means a player with level 100 can people at level 90 to level 110[/I][/COLOR]
[COLOR=#0000FF][B]local[/B][/COLOR] LEVEL_THRESHOLD [COLOR=#FF0000]=[/COLOR] 10
[COLOR=#0000FF][B]local[/B][/COLOR] [COLOR=#0000FF][B]function[/B][/COLOR] isPlayerAboveThreshold[COLOR=#FF0000]([/COLOR]cid[COLOR=#FF0000],[/COLOR] target[COLOR=#FF0000])[/COLOR]
[COLOR=#008000][I]-- This makes sure we are only processing statchanges made by PvP[/I][/COLOR]
[COLOR=#0000FF][B]if[/B][/COLOR][COLOR=#FF0000]([/COLOR]isPlayer[COLOR=#FF0000]([/COLOR]target[COLOR=#FF0000])[/COLOR][COLOR=#FF0000])[/COLOR][COLOR=#0000FF][B]then[/B][/COLOR]
[COLOR=#008000][I]-- We need to get the players levels of course[/I][/COLOR]
[COLOR=#0000FF][B]local[/B][/COLOR] attackerLvl[COLOR=#FF0000],[/COLOR] targetLvl [COLOR=#FF0000]=[/COLOR] getPlayerLevel[COLOR=#FF0000]([/COLOR]cid[COLOR=#FF0000])[/COLOR][COLOR=#FF0000],[/COLOR] getPlayerLevel[COLOR=#FF0000]([/COLOR]target[COLOR=#FF0000])
[/COLOR]
[COLOR=#008000][I]-- Now we shall check the actual threshold vs. the ideal one[/I][/COLOR]
[COLOR=#0000FF][B]if[/B][/COLOR][COLOR=#FF0000]([/COLOR]math[COLOR=#FF0000].[/COLOR]abs[COLOR=#FF0000]([/COLOR]attackerLvl [COLOR=#FF0000]-[/COLOR] targetLvl[COLOR=#FF0000])[/COLOR] > LEVEL_THRESHOLD[COLOR=#FF0000])[/COLOR][COLOR=#0000FF][B]then[/B][/COLOR]
[COLOR=#008000][I]-- OMG it's above the limit! We shall report back with what we found![/I][/COLOR]
[COLOR=#0000FF][B]return[/B][/COLOR] [COLOR=#0000FF][B]true[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[COLOR=#008000][I]-- At least one condition was not met. We shall say false![/I][/COLOR]
[COLOR=#0000FF][B]return[/B][/COLOR] [COLOR=#0000FF][B]false[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[COLOR=#0000FF][B]function[/B][/COLOR] onStatsChange[COLOR=#FF0000]([/COLOR]cid[COLOR=#FF0000],[/COLOR] attacker[COLOR=#FF0000],[/COLOR] [COLOR=#0080C0][B]type[/B][/COLOR][COLOR=#FF0000],[/COLOR] combat[COLOR=#FF0000],[/COLOR] value[COLOR=#FF0000])[/COLOR]
[COLOR=#0000FF][B]if[/B][/COLOR][COLOR=#FF0000]([/COLOR]isPlayerAboveThreshold[COLOR=#FF0000]([/COLOR]attacker[COLOR=#FF0000],[/COLOR] cid[COLOR=#FF0000])[/COLOR][COLOR=#FF0000])[/COLOR][COLOR=#0000FF][B]then[/B][/COLOR]
[COLOR=#0000FF][B]return[/B][/COLOR] [COLOR=#0000FF][B]false[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[COLOR=#0000FF][B]return[/B][/COLOR] [COLOR=#0000FF][B]true[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[COLOR=#0000FF][B]function[/B][/COLOR] onTarget[COLOR=#FF0000]([/COLOR]cid[COLOR=#FF0000],[/COLOR] target[COLOR=#FF0000])[/COLOR]
[COLOR=#0000FF][B]if[/B][/COLOR][COLOR=#FF0000]([/COLOR]isPlayerAboveThreshold[COLOR=#FF0000]([/COLOR]cid[COLOR=#FF0000],[/COLOR] target[COLOR=#FF0000])[/COLOR][COLOR=#FF0000])[/COLOR][COLOR=#0000FF][B]then[/B][/COLOR]
[COLOR=#0000FF][B]return[/B][/COLOR] [COLOR=#0000FF][B]false[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[COLOR=#0000FF][B]return[/B][/COLOR] [COLOR=#0000FF][B]true[/B][/COLOR]
[COLOR=#0000FF][B]end[/B][/COLOR]
[/FONT]