• 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 broadcastMessage error

bybbzan

mapper
Joined
Aug 4, 2012
Messages
809
Solutions
2
Reaction score
136
Location
Sweden
Hello!

I would like this message to be in MESSAGE_EVENT_ADVANCE
But i cant get it to work, im getting this error:

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/zombieEventDeath.lua:onPrepareDeath
data/creaturescripts/scripts/others/zombieEventDeath.lua:50: attempt to call loc
al 'playerName' (a string value)
stack traceback:
        [C]: in function 'playerName'
        data/creaturescripts/scripts/others/zombieEventDeath.lua:50: in function
 <data/creaturescripts/scripts/others/zombieEventDeath.lua:20>

line
Code:
        Game.broadcastMessage(string.format("%d place goes to %s of Zombie Event.", count, playerName(), MESSAGE_EVENT_ADVANCE))
 
I'm no expert, but I'd assume it's because of this
Code:
string.format
:P
I think your making the entire line a 'string.format' instead of just the words.
try this?
Code:
Game.broadcastMessage(string.format("%d place goes to %s of Zombie Event."), count, playerName(), MESSAGE_EVENT_ADVANCE)
 
Hello!

I would like this message to be in MESSAGE_EVENT_ADVANCE
But i cant get it to work, im getting this error:

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/zombieEventDeath.lua:onPrepareDeath
data/creaturescripts/scripts/others/zombieEventDeath.lua:50: attempt to call loc
al 'playerName' (a string value)
stack traceback:
        [C]: in function 'playerName'
        data/creaturescripts/scripts/others/zombieEventDeath.lua:50: in function
<data/creaturescripts/scripts/others/zombieEventDeath.lua:20>

line
Code:
        Game.broadcastMessage(string.format("%d place goes to %s of Zombie Event.", count, playerName(), MESSAGE_EVENT_ADVANCE))
The problem is you're calling playerName and its a string value. (read the error...)

Try:
Code:
        Game.broadcastMessage(string.format("%d place goes to %s of Zombie Event.", count, playerName), MESSAGE_EVENT_ADVANCE)
 
Back
Top