xbenny2506x Posted May 14, 2009 Share Posted May 14, 2009 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
Zadara Posted May 14, 2009 Share Posted May 14, 2009 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. 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
Gamesnert Posted May 14, 2009 Share Posted May 14, 2009 Nope it won't in fact. getVehicleOccupant is for retrieving an occupant of a vehicle, not the vehicle the player is occupying. 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
xbenny2506x Posted May 14, 2009 Author Share Posted May 14, 2009 omg Gamesnert you are my HERO BIG THX!!!! 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!!! Link to comment
[DKR]silverfang Posted May 15, 2009 Share Posted May 15, 2009 (edited) omg Gamesnert you are my HERO BIG THX!!!! 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 May 15, 2009 by Guest Link to comment
Lordy Posted May 15, 2009 Share Posted May 15, 2009 You know that you can get the size of the indexed array (as well as a length of a string) with #? like local array = {"dsa","dsa","dsa","dsa","sda"} local i = #array -- and i == 5 Link to comment
[DKR]silverfang Posted May 15, 2009 Share Posted May 15, 2009 You know that you can get the size of the indexed array (as well as a length of a string) with #?like local array = {"dsa","dsa","dsa","dsa","sda"} local i = #array -- and i == 5 I did not, thanks Link to comment
xbenny2506x Posted May 15, 2009 Author Share Posted May 15, 2009 BIG THX too all for the help but i need no randomspawn i have 8 spawn points and want that the player when they login spawn on one of the 8 points I hope you can help me with that too!! BIG THX!!! 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