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

Solved addevent problem

rudger

Active Member
Joined
Oct 1, 2010
Messages
273
Solutions
1
Reaction score
45
Location
The Netherlands
Hello,

My broadcast message doesn't work properly. This is the in-game output:

17:52 -1 was killed at level -1 by Sanchez. (unjustified)

it should be:

17:52 Tekof was killed at level 87 by Sanchez. (unjustified)

code:

Code:
local function broadcast_player_death(cid, target, lastHit, unjustified)
broadcastMessage(getCreatureName(target) .. " was killed at level " .. getPlayerLevel(target) .. " by " ..
getCreatureName(cid) .. ". (unjustified)")
end

function onKill(cid, target, lastHit, unjustified)


if (isPlayer(cid) and isPlayer(target) and unjustified) then
addEvent(broadcast_player_death, 10000, cid)
end

return 1
end

error:

Code:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/kill.lua:onKill

luaGetCreatureName(). Creature not found

Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/kill.lua:onKill

internalGetPlayerInfo(). Player not found. info = 2
 
You can do it like this.
Code:
addEvent(broadcastMessage, 10000, getCreatureName(target) .. " was killed at level " .. getPlayerLevel(target) .. " by " .. getCreatureName(cid) .. ". (unjustified)")
 
Back
Top