HeK Posted November 16, 2012 Posted November 16, 2012 I have been trying some stuff but none worked, i need to check if the player is in a vehicle and when he touches the marker, it shouldn't open the GUI. local vehicles = { } addEvent ( "spawnvehicle", true ) addEventHandler ( "spawnvehicle", root, function ( vehID ) if ( isElement ( vehicles [ source ] ) ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( vehID, getElementPosition ( source ) ) if ( vehicles [ source ] ) then setVehicleColor ( vehicles [ source ], 240, 240, 240 ) end setTimer ( warpPedIntoVehicle, 200, 1, source, vehicles [ source ] ) triggerClientEvent ( source, "closeWindow", root ) end ) Zero is a number too.
Castillo Posted November 17, 2012 Posted November 17, 2012 Post the code where you hit the marker. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
HeK Posted November 17, 2012 Author Posted November 17, 2012 addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( hitElement == localPlayer ) then createVehGui ( hitElement ) if ( MainGui ~= nil ) then guiSetVisible ( MainGui, true ) showCursor ( true ) guiSetInputEnabled ( true ) setElementFrozen ( hitElement, true ) end end end Zero is a number too.
Castillo Posted November 17, 2012 Posted November 17, 2012 addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( hitElement == localPlayer ) then if ( getElementType ( hitElement ) == "player" and not isPedInVehicle ( hitElement ) ) then createVehGui ( hitElement ) if ( MainGui ~= nil ) then guiSetVisible ( MainGui, true ) showCursor ( true ) guiSetInputEnabled ( true ) setElementFrozen ( hitElement, true ) end end end end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
HeK Posted November 17, 2012 Author Posted November 17, 2012 Thanks, it worked. Zero is a number too.
Castillo Posted November 17, 2012 Posted November 17, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
HeK Posted November 17, 2012 Author Posted November 17, 2012 One more thing, when players disconnect the vehicles stay in game, is there any way to fix that? Zero is a number too.
Castillo Posted November 17, 2012 Posted November 17, 2012 addEventHandler ( "onPlayerQuit", root, function ( ) if ( isElement ( vehicles [ source ] ) ) then destroyElement ( vehicles [ source ] ) end end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
HeK Posted November 17, 2012 Author Posted November 17, 2012 Should i just add that to the client script? Because i did and it didn't work. Zero is a number too.
Castillo Posted November 17, 2012 Posted November 17, 2012 Is a server side script. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
HeK Posted November 17, 2012 Author Posted November 17, 2012 Sorry for my stupidity. It's fixed. Thanks again. Zero is a number too.
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