• 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!

x Level To Kill x Level

Dramix

New Member
Joined
Jun 26, 2009
Messages
289
Reaction score
1
Hello, i need help with some script like this:
A level 200 can only minium kill a lvl 100 character, and a lvl 400 can only kill a lvl 200 character.

Like:
400-200 < Minium level to die
600-400 < Minium level to die
800-600 < Minium level to die

So if you are a level 800 you cant kill a char with lvl 500~ Only 600+ Understand? :p sry for my english.
 
Lua:
function onCombat(cid,target)
local c = getPlayerLevel(cid)
local t = getPlayerLevel(target)
 if c >= 200 and c < 600 and t < 200 then
  return false
 end
 if c >= 600 and c < 800 and t < 400 then
  return false
 end
 if c >= 800 and t < 600 then
  return false
 end
return true
end
 
Lua:
function onCombat(cid,target)
local c = getPlayerLevel(cid)
local t = getPlayerLevel(target)
 if c >= 200 and c < 600 and t < 200 then
  return false
 end
 if c >= 600 and c < 800 and t < 400 then
  return false
 end
 if c >= 800 and t < 600 then
  return false
 end
return true
end

Kk, thx :p Btw more information what is what:p and where i put it etc
 
goto creaturet--> scripts--> make new combat.lua
paste the code i gave you in,

Then goto creature.xml
Code:
<event type="combat" name="com" event="script" value="combat.lua"/>

Then go to creature --> scripts --> login.lua
[paste this before last return true]
Code:
registerCreatureEvent(cid, "com")
 
goto creaturet--> scripts--> make new combat.lua
paste the code i gave you in,

Then goto creature.xml
Code:
<event type="combat" name="com" event="script" value="combat.lua"/>

Then go to creature --> scripts --> login.lua
[paste this before last return true]
Code:
registerCreatureEvent(cid, "com")

Thx thx ( rep :p ) btw.. what mean this ones
if c >= 600 and c < 800 and t < 400 then << :S
 
this mean if player level more than 600 and les than 800 , and that target level is less than 400 then he will not be able to attack
 
when the error come, go to creature.xml remove the line and reload creature


[11/08/2010 18:37:02] [Error - CreatureScript Interface]
[11/08/2010 18:37:02] data/creaturescripts/scripts/combat.lua:eek:nCombat
[11/08/2010 18:37:02] Description:
[11/08/2010 18:37:02] (internalGetPlayerInfo) Player not found when requesting player info #3
 
Shortened and should work now..
Code:
function onCombat(cid,target)
	if not isPlayer(target) then return true end
	local c, t = getPlayerLevel(cid), getPlayerLevel(target)

	if (c >= 200 and c < 600 and t < 200) or (c >= 600 and c < 800 and t < 400) or (c >= 800 and t < 600) then
		return false
	end
	return true
end
 
PHP:
function onCombat(cid,target)
	if not isPlayer(target) then return true end
	local c, t = getPlayerLevel(cid), getPlayerLevel(target)

	if (c - t => 200) or (c - t =< -200) then
		return false
	end
	return true
end
Credits to Summ, but i think this does what Dramix really wanted it to do; making people unable to kill people 200 lvls higher or lower than themself.
Still, rep++ would be nice :D
 
Last edited:
Back
Top