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

Lua OnKill Level Up Frag

kaffekilla

New Member
Joined
Apr 27, 2009
Messages
25
Reaction score
0
Solved...this is the script V

Code:
function onKill(cid, target, lastHit)
	if isPlayer(target) and getPlayerLevel(cid) < 350 then
		doPlayerAddLevel(cid, 1)
	end
	return true
end
 
Last edited:
lmfao
Code:
if isPlayer(cid) and isPlayer(target) then
 if getPlayerLevel(cid) <= 349 then
   doPlayerAddPercentLevel(cid,100)
 end
end
return true
end
somethin like that I'm guessin. U have got some odd things in there..

what ur doin in ur script is if is player, then do nothing, else do add levels lol.
 
Its fine, keep at it. try looking up examples of how xml and lua trees n children work on google. That gives a great amount of understanding to this tibia scripting stuff :p
 
Ok I tried this
function onKill(cid, target, lastHit)

if isPlayer(cid) and isPlayer(target) then
if getPlayerLevel(cid) <= 349 then
GetPlayerLevel(cid, doPlayerAddLevel(cid, 1))
end
end
return true
end

But still doesn't work...
 
This should work
Lua:
function onKill(cid, target, lastHit)
if isPlayer(cid) then
   if isPlayer(target) then
      doPlayerAddExp(cid, getExperienceForLevel(getPlayerLevel(cid)+1) - getPlayerExp(cid))
   end
end
return true
end
 
Try this:
Lua:
function onKill(cid, target, lastHit)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerLevel(cid) <= 349 then
			doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid)+1))	
		end
	end
return true
end
 
@^ ??
Lua:
function onKill(cid, target, lastHit)
	if isPlayer(target) and getPlayerLevel(cid) < 350 then
		doPlayerAddLevel(cid, 1)
	end
	return true
end
 
@^ ??
Lua:
function onKill(cid, target, lastHit)
	if isPlayer(target) and getPlayerLevel(cid) < 350 then
		doPlayerAddLevel(cid, 1)
	end
	return true
end

That exists? lol pwna.
@Shinmaru: You forgot to - the player exp or it will add loads of exp
 
Last edited:
yeah, why do you check twice isPlayer(cid) if that is already checked with registerCreatureEvent(cid, eventname) :p
 
Checking that the target is a player might be a bad idea, I mean, you could have no target and hit a ue and killing somebody and because of that not get a reward.
 
Checking that the target is a player might be a bad idea, I mean, you could have no target and hit a ue and killing somebody and because of that not get a reward.

Use lastHit then?
Lua:
if isPlayer(cid) or isPlayer(lastHit) then
 
Back
Top