Jump to content

Teleport with a Vehicle and i need 7-8 start spawn points :)


Recommended Posts

HI!

I have add this as teleport point:

  
function hjwarp (source) 
    setElementPosition ( source, 886.24, 2479.17, 258.32 ) 
    outputChatBox ( "You're warped to Hight Jump hj!", source, 0, 255, 0 ) 
end 
addCommandHandler ( "hj", hjwarp ) 
  

But that script teleport only a player where is not in a vehicle, is the a way that the player can warp with a car to my teleport points?

I have a Freeroam server and want that the üöayer warp when they login on one of my 6 spawn points and when somone die he warp back to one of this point.

PLZ can someone here say me how i can do that????

BIG THXXXXXX

Link to comment

You need first to check, if the player is in a vehicle, well that we do with getVehicleOccupant, implant that good in your script and it should work. Here you are. I'm not sure of this work, because i never work with this function. :oops:

function hjwarp (source) 
    local vehicle = getVehicleOccupant ( source, 0 ) 
    setElementPosition ( vehicle, 886.24, 2479.17, 258.32 ) 
    outputChatBox ( "You're warped to Hight Jump hj!", source, 0, 255, 0 ) 
end 
addCommandHandler ( "hj", hjwarp ) 

Link to comment

Nope it won't in fact. getVehicleOccupant is for retrieving an occupant of a vehicle, not the vehicle the player is occupying. :P

function hjwarp (player) 
    if isPlayerInVehicle(player) then -- If the player is in a vehicle... 
        local vehicle=getPlayerOccupiedVehicle(player) -- Obtain the vehicle the player is in 
        if getVehicleController(vehicle)==player then -- If the player is the driver... 
            setElementPosition (vehicle , 886.24, 2479.17, 258.32 ) -- Warp the vehicle 
            outputChatBox ( "You're warped to Hight Jump hj!", player, 0, 255, 0 ) 
        end 
    else -- If the player isn't in a vehicle... 
        setElementPosition (player , 886.24, 2479.17, 258.32 ) -- Warp the player 
        outputChatBox ( "You're warped to Hight Jump hj!", player, 0, 255, 0 ) 
    end 
end 
addCommandHandler ( "hj", hjwarp ) 

This might work a little better. Still not entirely sure if it's entirely correct, since I didn't test it, but it should do the job. ;)

NOTE: I can remember vehicles acting a little... Weird... After warping. If it bothers you too much, you should try something with setVehicleFrozen, I can remember someone saying it would help.

Link to comment
omg Gamesnert you are my HERO :D BIG THX!!!! :thumbright::thumbright::thumbright::thumbright::thumbright:

I hope so someone here can help me with the 7-8 start spawn points and when a player die he respawn on one of this 7-8 places!!!

Create an array with all the values:

  
--the array 
spawnArray{  
{x, y, z},    --x is the x co-ord, y is the y co-ord, z is the z co-ord 
{x2, y2, z2}, 
... --repeat for however many you need 
} 
  
function spawn(player, command) 
  
    maximum = #spawnArray --make the maximum value the length of the array 
  
  
    index = math.random(1, maximum) --get a random integer between 1 and the max 
  
    spawnPlayer(player, spawnArray[index][1], spawnArray[index][2], spawnArray[index][3]) --spawnPlayer at the random position 
end 
addCommandHandler("randomspawn", spawn) --when randomspawn is typed the function will be called 
  
  

This is currently done by command, if you want it to be done when the player dies, use onPlayerWasted.

Edited by Guest
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...