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

[Lua] How does param work?

Albanon

New Member
Joined
Mar 5, 2011
Messages
93
Reaction score
1
I'm trying to make a talk action script that recognizes perameters, for instance

/test one should send the player a message that says one

/test two should send the player a message that says two

Here's what I have so far

PHP:
function onSay(cid, words, param)
	if param == "" then
		doPlayerSendTextMessage(cid,21, "please type a valid paremeter")

I don't know how to precede after this though, how do I make it recogize /test one and /test two?



Edit: Im using mystic spirit 2.10
 
LUA:
function onSay(cid, words, param, channel)
if(param == '') then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	return true
end
local t = string.explode(param, ",")
if t[1] == "one" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "One")
elseif t[1] == "two" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Two")
end
return true
end
 
Last edited:
LUA:
local t = string.explode(param, ",")
mean it will explode the parameters like /test first word,second word,third word
t[1] = first word, t[2] = second word,t[3] = third word etc
also check the script again i forgot to add return true :P
 
Last edited:
Thanks again for the response, however, it still doesn't work :( I'm typing /test one and nothing happens. What does return do anyway?
 
none at all which is odd, what server are you using? if I do /test it says no param just fine, but if i type /test one nothing happens, same for test two
 
It also displays the text in the channel when I say it, so my character says /test one and /test. It doesn't look like that happened for you in your screenshot


Ah, sorry for the extra post, I meant to edit
 
I tried but there's still no success :( I have no idea how it could work for you but not for me. im using 2.10 mystic spirit
 
Back
Top