Jump to content

disable vehicle alpha


Samking

Recommended Posts

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?

Link to comment
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

Link to comment
8 hours ago, MrKAREEM said:

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)

 

Link to comment
  • Moderators
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.

Link to comment
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.

Link to comment

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 by salh
Link to comment
  • Moderators

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)

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...