Jump to content

Teleporting?


idiot

Recommended Posts

Hi,

would it be possible that someone makes a "teleport" script? I mean that the client only must write "/s1" (just an example of what I dream :P) to save his position. And if he pushes the "1" on the keyboard he spawns at the "/s1"-position. Then 1-9 that each client can save a few personal positions. When the client writes "/s1" again the old position should be overwritten for the new one.

If it shouldn't work to spawn by pushing 1-9 it would be also okay with typing "/l1" (1-9).

Simple example:

Player:/s7

Console:Position 7 saved! Type ' /l7 ' to spawn.

Player:/l7

Console:Position 7 loaded! You spawned. Type ' /s7 ' again to overwrite.

greetz ruschiiiii

Link to comment

Not much really.

I've got it "almost" working. Almost because players are elements and it is quite difficult to store all the coords in an array. In SA:MP, players are integers, so it would be really easy there.

I'm trying to figure out how to store players' coords in a table and then load them.

Link to comment

You can use elements to index tables, just like you would use an integer to index an array:

  
local teleportPoints = {} 
local x,y,z = getElementPosition(player) 
teleportPoints[player][0].x = x 
teleportPoints[player][0].y = y 
teleportPoints[player][0].z = z 
  

Alternatively, you can just use setElementData.

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...