Samking Posted June 1, 2019 Posted June 1, 2019 function alpha( thePlayer ) if isPedInVehicle(source) == false then outputChatBox("You do not have a Vehicle", thePlayer,255, 0, 0, true ) end if (isPedInVehicle (source)) then setElementAlpha ( getPedOccupiedVehicle(source),0) end end addEvent("alp",true) addEventHandler("alp",getRootElement(),alpha) How I can set alpha to 255 when the player exit the vehicle?
MrKAREEM Posted June 1, 2019 Posted June 1, 2019 7 minutes ago, Samking said: function alpha( thePlayer ) if isPedInVehicle(source) == false then outputChatBox("You do not have a Vehicle", thePlayer,255, 0, 0, true ) end if (isPedInVehicle (source)) then setElementAlpha ( getPedOccupiedVehicle(source),0) end end addEvent("alp",true) addEventHandler("alp",getRootElement(),alpha) How I can set alpha to 255 when the player exit the vehicle? OnClientPlayerVehicleExit SetElementAlpha
Samking Posted June 1, 2019 Author Posted June 1, 2019 8 hours ago, MrKAREEM said: OnClientPlayerVehicleExit SetElementAlpha Thanks, I make the code with the help of you. but there is one problem it didn't give an output when alpha is set to 255 on vehicle exit. function apoff( thePlayer ) if getElementAlpha( thePlayer ) == 0 then setElementAlpha ( thePlayer, 255 ) outputChatBox ( "Alpha Auto set to 255",thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end addEventHandler("onClientPlayerVehicleExit", getRootElement(),apoff)
DNL291 Posted June 1, 2019 Posted June 1, 2019 addEventHandler("onVehicleExit", root, function( thePlayer, seat, jacked ) if getElementAlpha( thePlayer ) == 0 then setElementAlpha ( thePlayer, 255 ) outputChatBox ( "Alpha Auto set to 255", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end) Try it.
Samking Posted June 2, 2019 Author Posted June 2, 2019 56 minutes ago, DNL291 said: addEventHandler("onVehicleExit", root, function( thePlayer, seat, jacked ) if getElementAlpha( thePlayer ) == 0 then setElementAlpha ( thePlayer, 255 ) outputChatBox ( "Alpha Auto set to 255", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end) Try it. sorry bro it only gives output "unknown error" but did not change the alpha to 255.
salh Posted June 2, 2019 Posted June 2, 2019 (edited) in the first code you get the alpha of the car in this code addEventHandler("onVehicleExit", root, function( thePlayer, seat, jacked ) if getElementAlpha( thePlayer ) == 0 then setElementAlpha ( thePlayer, 255 ) outputChatBox ( "Alpha Auto set to 255", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end) you get the player alpha Edited June 2, 2019 by salh
DNL291 Posted June 2, 2019 Posted June 2, 2019 Oh, you want it to change the vehicle's visibility (not the player skin/ped). Try this: addEventHandler("onVehicleExit", root, function( thePlayer, seat, jacked ) if getElementAlpha( source ) == 0 then setElementAlpha ( source, 255 ) outputChatBox ( "Alpha Auto set to 255", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end) addEventHandler("onVehicleEnter", root, function( thePlayer, seat, jacked ) if getElementAlpha( source ) ~= 0 then setElementAlpha ( source, 0 ) outputChatBox ( "Alpha Auto set to 0", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end)
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