LiOneLMeSsIShoT Posted December 1, 2013 Share Posted December 1, 2013 I've made this simple script to set the player position...but when i try to do /setpos 125 156..like use x, y..i get error in debugscript 3 ...and i don't want this error move to debugscript 3 because it's mistake to write x and y..or even z only..so how to fix this? function pSet (source, commandName, arg, posX, posY, posZ) if arg then setElementPosition (source, posX, posY, posZ) else outputChatBox ("Use: /setpos x,y,z", source, 255, 0, 0, false) end end addCommandHandler ( "setpos", pSet ) Link to comment
tosfera Posted December 1, 2013 Share Posted December 1, 2013 The arg = the first argument. Your command will be right now; /setpos arg 0 0 5 remove the 'arg' part. Link to comment
TAPL Posted December 1, 2013 Share Posted December 1, 2013 function pSet(source, commandName, posX, posY, posZ) local posX, posY, posZ = tonumber(posX), tonumber(posY), tonumber(posZ) if posX and posY and posZ then setElementPosition(source, posX, posY, posZ) else outputChatBox("Use: /setpos x,y,z", source, 255, 0, 0) end end addCommandHandler("setpos", pSet) Link to comment
LiOneLMeSsIShoT Posted December 1, 2013 Author Share Posted December 1, 2013 function pSet(source, commandName, posX, posY, posZ) local posX, posY, posZ = tonumber(posX), tonumber(posY), tonumber(posZ) if posX and posY and posZ then setElementPosition(source, posX, posY, posZ) else outputChatBox("Use: /setpos x,y,z", source, 255, 0, 0) end end addCommandHandler("setpos", pSet) Thanks 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