Overkillz Posted September 4, 2014 Share Posted September 4, 2014 Hey everyone, How are u ? I hope u are ok ^^ I will like to about getVehicleOccupants I have made a Info radar, which is using addEventHandler("onClientRender", root, function ( source ) local playerVehicle = getPedOccupiedVehicle(localPlayer) if playerVehicle then dxDrawImage(posx,posy*1.25,height,height2, "data/radar/info.png",0,0,0,tocolor(255,255,255,255)) -- Info Imagen end end) InfoRadar is showed when the player is in vehicle, dat works perfectly with 0 km/h, but When a player has a hight velocity like 221 km/h and press enter, the radar still showing even if he is died. There is some method fix it ? I will like to do it if the player is died, don't show it, and the player is alive or training, then yes. I hope u can help me. Regards. Link to comment
Overkillz Posted September 4, 2014 Author Share Posted September 4, 2014 Some help to remplace getPedOccupiedVehicle(localPlayer) ? Link to comment
'LinKin Posted September 5, 2014 Share Posted September 5, 2014 And what happens if a player is driving at 100 km/h and presses enter, and dies? Is it still showing? If so - Then make this event: onClientPlayerWasted and at the beginning of its implementation put: if source == localPlayer (This makes sure the player that died was the same client) Link to comment
myonlake Posted September 5, 2014 Share Posted September 5, 2014 Use your own functions to check if the player is in a vehicle. You can use this by manually checking when a player has fully entered the vehicle, and when the player has just started to exit the vehicle. This way you know if and when the player is actually inside of the vehicle. Just make sure to attach the exit stuff with your existing exit event, or otherwise your other statements may be ignored. Link to comment
Overkillz Posted September 5, 2014 Author Share Posted September 5, 2014 Use your own functions to check if the player is in a vehicle. You can use this by manually checking when a player has fully entered the vehicle, and when the player has just started to exit the vehicle. This way you know if and when the player is actually inside of the vehicle. Just make sure to attach the exit stuff with your existing exit event, or otherwise your other statements may be ignored. Somethings to check about u suggested me ? U mean like this if state == "alive" or state == "training" then --show radar. ? Link to comment
myonlake Posted September 5, 2014 Share Posted September 5, 2014 (edited) I don't understand your example. addEventHandler( "onClientVehicleEnter", root, function( player ) if ( not isElement( player ) ) or ( getElementType( player ) ~= "player" ) then return end setElementData( player, "player:vehicle.occupied", true, true ) end ) addEventHandler( "onClientVehicleStartExit", root, function( player ) if ( not isElement( player ) ) or ( getElementType( player ) ~= "player" ) then return end setElementData( player, "player:vehicle.occupied", false, true ) end ) function isInVehicle( player ) if ( isElement( player ) ) and ( getElementType( player ) == "player" ) and ( getElementData( player, "player:vehicle.occupied" ) ) then return true end return false end addEventHandler( "onClientRender", root, function( ) if ( isInVehicle( localPlayer ) ) then dxDrawImage( posx, posy * 1.25, height, height2, "data/radar/info.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ) ) end end ) Edited September 5, 2014 by Guest Link to comment
Overkillz Posted September 5, 2014 Author Share Posted September 5, 2014 I don't understand your example. addEventHandler( "onClientVehicleEnter", root, function( player ) setElementData( player, "player:vehicle.occupied", true, true ) end ) addEventHandler( "onClientVehicleStartExit", root, function( player ) setElementData( player, "player:vehicle.occupied", false, true ) end ) function isInVehicle( player ) if ( getElementData( player, "player:vehicle.occupied" ) ) then return true end return false end addEventHandler( "onClientRender", root, function( ) if ( isInVehicle( localPlayer ) ) then dxDrawImage( posx, posy * 1.25, height, height2, "data/radar/info.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ) ) end end ) Thanks, I found a method, anyway thanks for ur help. 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