• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

(Need Script) No attack with certain level of diference

armitxe

New Member
Joined
Feb 15, 2009
Messages
65
Reaction score
1
Hello everyone...

I'm hosting a WAR OT, but i got the problem that the players level up very faster by one or other way... i tried changing the experiece, etc... but still the problem...

So i want to know if you guys please can help me with this script:

I want a script that makes that when there's a certain diference in the level of the players they can't attack each other...

For example: The script works with 400 level

So one level 100 can't attack a level 500 and a level 500 can't ttack a player of level 100...

If you guys can help me with that i really will be grateful!

Thanks!

Greetings!
 
LUA:
function onCombat(cid, target)
	if (getPlayerLevel(target) > 500 and getPlayerLevel(cid) < 100) then
		doPlayerSendCancel(cid, "You cannot attack a player of level 500 and over.")
	end	
	  if (getPlayerLevel(cid) > 500 and getPlayerLevel(target) < 100) then
                doPlayerSendCancel(cid, "You cannot attack players of level 100 and below.")
	end
	return TRUE
end
 
Last edited:
Code:
function onCombat(cid, target)
	if isPlayer(target) then
		local cl, tl = getPlayerLevel(cid), getPlayerLevel(target)
		if tl >= cl - 400 and tl <= cl + 400 then
			return true
		else
			return false, doPlayerSendCancel(cid, "You cannot attack this player.")
		end
	end
	return true
end
 
Thank you both guys!

But it don't work :S, i'm sure that it's my fault, maybe i'm writing something wrong

creaturescripts.xml

Code:
<event type="combat" name="LevelProtect" event="script" value="levelpro2.lua"/>

creaturescripts\levelpro2(or 1)

Code:
ANY SCRIPT

I tested both and it has no effect :S

Can you help me to solve it please?

And i have a question, that would work also with the area attacks? i mean, when a player make a "exevo gran mas vis" if there is the differences between the level, the lower or higher player will take no damage?

Thanks in advance!
Sorry for my bad english!

Greetings!
 
@Up
And why did you answer the same thing I said?

and btw, is not "registerCreatureEvent(cid, "levelpro2")"... It should be
LUA:
registerCreatureEvent(cid, "LevelProtect")
 
Jajaja, SexiDevil thanks!

But what i did was this

creaturescripts.xml

Code:
<event type="combat" name="levelpro2" event="script" value="levelpro2.lua"/>

login

Code:
registerCreatureEvent(cid, "levelpro2")

xD

But it don't work :S
 
ok then we need to test if this can even be done this way, try this script:
Code:
function onCombat(cid, target)
	return false
end
 
nab

LUA:
function onCombat(cid, target)
    return isPlayer(target) and (math.abs((getPlayerLevel(cid) - getPlayerLevel(target))) < 400) or false
end
 
LUA:
function onCombat(cid, target)
    return isPlayer(target) and (math.abs((getPlayerLevel(cid) - getPlayerLevel(target))) < 400) or true
end

now i will back to my cave 8( bb
 
Back
Top