Jump to content

[Help] Vehicle Destory


3B00DG4MER

Recommended Posts

Hello,this my old script,i have add some of features

I want this Time when The Black team or White team Enter vehicle destroy it

Client :

  
addEventHandler("onClientVehicleEnter", getRootElement(), 
    function(theVehicle,thePlayer, seat) 
    if(getTeamName(thePlayer) == "WhiteTeam" or getTeamName(thePlayer) == "BlackTeam") then 
    local veh = getVehicleName(theVehicle) 
            destroyElement( veh ) 
        end 
    end 
) 
  

Link to comment
getTeamName requires a team element, use getPlayerTeam to obtain the team element.

You mean That ?

addEventHandler("onClientVehicleEnter", getRootElement(), 
    function(source,theVehicle,thePlayer, seat) 
    if(getPlayerTeam(source) == "WhiteTeam" or getPlayerTeam(source) == "BlackTeam") then 
    local veh = getVehicleName(theVehicle) 
            destroyElement( veh ) 
        end 
    end 
) 

But nothing Happend :(

Link to comment

No, getPlayerTeam returns a team element, to get the name you must use

getTeamName ( getPlayerTeam ( thePlayer ) ) 

Like this:

addEventHandler ( "onClientVehicleEnter", getRootElement(), 
    function ( thePlayer ) 
        local teamName = getTeamName ( getPlayerTeam ( thePlayer ) ) 
        if ( teamName == "WhiteTeam" or teamName == "BlackTeam")  then 
            destroyElement ( source ) 
        end 
    end 
) 

Link to comment

Well, i am not set to help as i am a beginner but i think that should work ( didn't test it )

addEventHandler ( "onClientVehicleEnter", getRootElement(), 
    function ( thePlayer ) 
        local teamName = getTeamName ( getPlayerTeam ( thePlayer ) ) 
        if ( teamName == "WhiteTeam" or teamName == "BlackTeam")  then 
        local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
    destroyElement(theVehicle) 
        end 
    end 
) 

Link to comment
addEventHandler ( "onVehicleEnter", root, 
    function ( player ) 
        local team = getTeamName ( getPlayerTeam ( player ) ) 
        if ( team == "WhiteTeam" or team == "BlackTeam" ) then 
            destroyElement ( source ) 
        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...