Backsage Posted October 19, 2013 Share Posted October 19, 2013 (edited) Hi, guys. I have a problem. I've created 2 scripts, one of which allows you to enter a marker at LV Stadium and spawn at a custom interior, which is under the 'warpToArena' resource. The other script allows you to enter a marker in the interior and spawns you back to the Stadium, which is under the 'warpBackToStadium' resource. I had to put the scripts under separate resources because of some problems. One of the problems is that when I have both of them on, when I enter the marker from the interior, it warps me back to the Stadium. But when I enter the Stadium marker, it keeps bringing me back to the position of the Stadium marker and not at the interior. So how do I make it so it can be vice-versa and under one lua script? Also, when players enter the marker and spawn, they get a different skin, based on what's written in the script. How do I make it so they don't lose their current skin after spawning? Here are the scripts. myMarker = createMarker ( 1099.67, 1600.73, 13.05, "arrow", 1.0, 255, 255, 0, 0 ) local function warpToArena(markerHit, matchingDimension, myMarker) if (matchingDimension) then spawnPlayer (source, 924.39, 1582.29, -16.91, 0, 0, 0, 0) fadeCamera (source, true) setCameraTarget (source, source) end end addEventHandler("onPlayerMarkerHit",getRootElement(),warpToArena) myMarker = createMarker ( 928, 1590, -16.91, "arrow", 1.0, 255, 255, 0, 0 ) local function warpbacktostadium(markerHit, matchingDimension, myMarker) if (matchingDimension) then spawnPlayer (source, 1099.67, 1600.73, 13.05, 0, 0, 0, 0) fadeCamera (source, true) setCameraTarget (source, source) end end addEventHandler("onPlayerMarkerHit",getRootElement(),warpbacktostadium) Edited October 19, 2013 by Guest Link to comment
xXMADEXx Posted October 19, 2013 Share Posted October 19, 2013 Your code really didn't make much scenes. local myMarker = createMarker ( 928, 1590, -16.91, "arrow", 1.0, 255, 255, 0, 0 ) function warpToArena(p , matchingDimension ) if ( getElementType ( p ) == 'player' and matchingDimension) then spawnPlayer (p, 1099.67, 1600.73, 13.05, 0, 0, 0, 0) fadeCamera (p, true) setCameraTarget (p, p) end end addEventHandler("onMarkerHit",myMarker,warpToArena) Link to comment
Backsage Posted October 19, 2013 Author Share Posted October 19, 2013 Your code really didn't make much scenes. local myMarker = createMarker ( 928, 1590, -16.91, "arrow", 1.0, 255, 255, 0, 0 ) function warpToArena(p , matchingDimension ) if ( getElementType ( p ) == 'player' and matchingDimension) then spawnPlayer (p, 1099.67, 1600.73, 13.05, 0, 0, 0, 0) fadeCamera (p, true) setCameraTarget (p, p) end end addEventHandler("onMarkerHit",myMarker,warpToArena) My script didn't make any sense? Yours didn't even work! .__. Maybe I need to do something with 'matchingDimension' and set all the interior objects in a different dimension. Edit: Nope. That didn't do anything. I still need help though Also, the way that it's working now is that I can go to the Stadium marker and it'll warp me to the interior, but if I go to the interior marker, it keeps spawning me in the interior and not back to the Stadium. Link to comment
pa3ck Posted October 19, 2013 Share Posted October 19, 2013 Don't set its position to the first marker, because the player's gonna hit it and will be teleported back to the stadium. Use different variables as well like marker1 and marker2. Link to comment
Moderators IIYAMA Posted October 19, 2013 Moderators Share Posted October 19, 2013 Why not setElementPosition? Required Arguments theElement: A valid element to be moved. x: The x coordinate of the destination. y: The y coordinate of the destination. z: The z coordinate of the destination. Optional Arguments warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation. Returns Returns true if the function was successful, false otherwise. Also: https://wiki.multitheftauto.com/wiki/IsPedInVehicle 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