Hale Posted September 4, 2015 Share Posted September 4, 2015 So I have this problem with element attachments (I think) in my SMS system. What happens is next: I send an SMS to lets say number 1337, and when that person wants to respond by /rsms *message* it returns the two outputchatbox lines, "SYNTAX..." and "Use..." ones. The problem is probably in the last line, but I tried lots of things and, well, none really worked tbh lol. Any ideas of how to fix this? if tostring(commandName):lower() == "rsms" and (...) then local target = getElementData(thePlayer, "targetSMSer") if not (...) then outputChatBox("No one sent you an SMS to reply on.", thePlayer, 255,0,0) return false end message = phoneNumber.." "..table.concat({...}, " ") else if tostring(commandName):lower() == "sms" and not number or not (...) then outputChatBox("SYNTAX: /sms [number] [message]", thePlayer, 255, 194, 14) outputChatBox("Use /rsms to reply on your most recent SMS.", thePlayer) elseif callerphoneIsTurnedOn == 0 then outputChatBox("Your phone is off.", thePlayer, 255, 0, 0) elseif getElementData(thePlayer, "injuriedanimation") then outputChatBox("You can't use your phone while knocked out.", thePlayer, 255, 0, 0) elseif exports.global:hasMoney(thePlayer, 1) then local message = table.concat({...}, " ") setElementData(thePlayer, "targetSMSer", phoneNumber, false) Link to comment
JR10 Posted September 5, 2015 Share Posted September 5, 2015 Why not use addCommandHandler for each command? Also, you should store "..." in a table and then check its length. local args = {...} Link to comment
Hale Posted September 5, 2015 Author Share Posted September 5, 2015 I am using it, although in a different function. Well, what's the difference? As I don't really need to know the length, is it important or something? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now