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

TFS 0.X talkactions command with param

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, i try create command with two params, but it not work without any errors :(

Code:
function onSay(cid, item, frompos, item2, topos, words, channel, param)
    if(param == '') then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
     return true
     end
if param == "on" then
    item = doCreateItem(1387, 1, {x = 1000, y = 1000, z = 7})
doItemSetAttribute(item, "aid", 10207)

elseif param == "off" then
    pos_tp = {x = 1000, y = 1000, z = 7}
    doRemoveItem(getThingfromPos(pos_tp).uid, 1)

end
end
 
What does console say when you execute:
Lua:
print('['.. param ..']')

You might need to split the string into both words, and then handle them appropriately.

You might wanna add dump.lua to your data/global.lua file:

That way you can easily examine data passes through functions to determine how they work.
Then you can do:
Lua:
tdump("words", words)
tdump("param", param)

To look at the function parameters from the console when they are executed.
 
What does console say when you execute:
Lua:
print('['.. param ..']')

You might need to split the string into both words, and then handle them appropriately.

You might wanna add dump.lua to your data/global.lua file:

That way you can easily examine data passes through functions to determine how they work.
Then you can do:
Lua:
tdump("words", words)
tdump("param", param)

To look at the function parameters from the console when they are executed.

How execute print in console? I can't say anything in my console, when i added it to lua file and say command i get it:

Code:
[11:24:58.680] [Error - TalkAction Interface]
[11:24:58.681] data/talkactions/scripts/anviltp.lua:onSay
[11:24:58.681] Description:
[11:24:58.681] data/talkactions/scripts/anviltp.lua:2: attempt to concatenate local 'param' (a nil value)
[11:24:58.691] stack traceback:
[11:24:58.691]  data/talkactions/scripts/anviltp.lua:2: in function <data/talkactions/scripts/anviltp.lua:1>
 
Back
Top