Swatrat Posted May 9, 2015 Share Posted May 9, 2015 Hello! Yesterday I started working on freeroam server which has bank in it. I didn't wanted my players to need to travel to the bank before being able to deposit money in it so I wanted to make warp command with which you can teleport infront of the bank entrance, but the problem is that you need to be outside of the car so I wanted to make the script being able to warn them about it. I made it but there's a problem. local x,y,z = getElementPosition(player) addCommandHandler( "bank", function( player ) setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) then if ( x == 2414.16919 ) and ( y == 1123.87756) and (z == 10.82031) then outputChatBox("You have been teleported successfully", 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!") end end ) The warp script actually works but after I added getElementPosition both the warp and warn script stopped working. Any help is appreciated! Link to comment
Walid Posted May 9, 2015 Share Posted May 9, 2015 Try this one function teleport( player ) if isElement(player) then if not isPedInVehicle(player) then setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",player, 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!") end end end addCommandHandler( "bank",teleport)) Link to comment
Swatrat Posted May 9, 2015 Author Share Posted May 9, 2015 Try this one function teleport( player ) if isElement(player) then if not isPedInVehicle(player) then setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",player, 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!") end end end addCommandHandler( "bank",teleport)) It doens't work but I fixed this one cuz it was easier for me instead of the one I made. There it is the working one: function teleport( ) if not isPedInVehicle(getLocalPlayer()) then setElementPosition( getLocalPlayer(), 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",255,0,0) end end addCommandHandler( "bank",teleport) Thanks for the help! Link to comment
Walid Posted May 9, 2015 Share Posted May 9, 2015 * this server side function teleport( player ) if isElement(player) then if not isPedInVehicle(player) then setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",player, 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",player,255,0,0) end end end addCommandHandler( "bank",teleport)) * and this client side function teleport( ) if not isPedInVehicle(getLocalPlayer()) then setElementPosition( getLocalPlayer(), 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",255,0,0) end end addCommandHandler( "bank",teleport) Thanks for the help! anyways you are welcome. Link to comment
Swatrat Posted May 9, 2015 Author Share Posted May 9, 2015 * this server side function teleport( player ) if isElement(player) then if not isPedInVehicle(player) then setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",player, 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",player,255,0,0) end end end addCommandHandler( "bank",teleport)) * and this client side function teleport( ) if not isPedInVehicle(getLocalPlayer()) then setElementPosition( getLocalPlayer(), 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",255,0,0) end end addCommandHandler( "bank",teleport) Thanks for the help! anyways you are welcome. Damn, I forgot to check if it's server-side, since I am new in scripting it's kinda hard for me to distinguish client from server side. 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