• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

(Luadoplayeradditem) Player Not Found

esker

New Member
Joined
Oct 11, 2009
Messages
17
Reaction score
0
I'm new script, trying to do one where you kill the player in area X you win an item.

but it is giving this error

[23:57:36.841] [Error - CreatureScript Interface]
[23:57:36.842] data/creaturescripts/scripts/monster.lua:onPrepareDeath
[23:57:36.843] Description:
[23:57:36.844] (luaDoPlayerAddItem) Player not found

local arena = {
frompos = {x=32499, y=32369, z=7},
topos = {x=32567, y=32418, z=7},
exit = {x=32370, y=32231, z=5}
}

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then

doPlayerAddItem(lastHitKiller, 2160,10)
end
end
return TRUE
end
 
LOL! You should do this with function onKill. :o
LUA:
local arena = {
frompos = {x=32499, y=32369, z=7},
topos = {x=32567, y=32418, z=7},
exit = {x=32370, y=32231, z=5}
}
function onKill(cid, target) 
if isPlayer(target) or isSummon(target) or isNpc(target) then  
    return true  
end
if isPlayer(target) == TRUE then
    if isInArea(getPlayerPosition(target), arena.frompos, arena.topos) then
        doPlayerAddItem(cid, 2160,10)
    end
    return true
end
    return true
end
 
@GarQet "if isPlayer(target)" x2 :P

LUA:
local arena = {
	frompos = {x=32499, y=32369, z=7},
	topos = {x=32567, y=32418, z=7},
	exit = {x=32370, y=32231, z=5}
}
function onKill(cid, target) 
	if isPlayer(target) and isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
		doPlayerAddItem(cid, 2160, 10)
	end

	return true
end
I have not tested yet
 
Back
Top