Jump to content

Spawn Point


bygcrazy

Recommended Posts

Hey thanks very useful you think this might work?

addCommandHandler("chilliad", myFunction)
function consoleSetPlayerPosition ( source, chilliad,343,1, 43 )
setElementPosition ( source, 234,1, 4 )
end
addCommandHandler ( "setpos", consoleSetPlayerPosition  )

No, it won't work.

1. What is the first line (addCommandHandler) doing there? Nothing, unless you have myFunction somewhere above that you didn't show us here.

2. Making new function's parameters is not passing arguments.

3. NEVER name parameters source even for command handlers. You don't want that, believe me.

Basically, I think you need to get some more basic knowledge... Visit these 2 links:

- https://wiki.multitheftauto.com/index.ph ... troduction

- http://robhol.net/guide/basics

Link to comment

Hey thanks very useful you think this might work?

addCommandHandler("chilliad", myFunction)
function consoleSetPlayerPosition ( source, chilliad,343,1, 43 )
setElementPosition ( source, 234,1, 4 )
end
addCommandHandler ( "setpos", consoleSetPlayerPosition  )

No, it won't work.

1. What is the first line (addCommandHandler) doing there? Nothing, unless you have myFunction somewhere above that you didn't show us here.

2. Making new function's parameters is not passing arguments.

3. NEVER name parameters source even for command handlers. You don't want that, believe me.

Basically, I think you need to get some more basic knowledge... Visit these 2 links:

- https://wiki.multitheftauto.com/index.ph ... troduction

- http://robhol.net/guide/basics

Now is better or still need to fixi t

function consoleSetPlayerPosition ( source, commandName, 232,1, 3 )
setElementPosition ( source, 231, 2, 323 )
end
addCommandHandler ( "stunt", consoleSetPlayerPosition  )

Link to comment

You're getting this one for free: after this, you need to learn for yourself.

function consoleSetPlayerPosition(player,command,x,y,z)
   x,y,z = tonumber(x),tonumber(y),tonumber(z)    --convert strings to numbers
if x and y and z then    --if all arguments were valid
setElementPosition(player,x,y,z)  --move player to provided position
else
outputChatBox("Error: position invalid. Syntax is '/setpos x y z'",player,255,0,0)   --output message on syntax error
end
end
addCommandHandler("setpos",consoleSetPlayerPosition)  --command used as "/setpos 1000 2000 30"

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...