Jump to content

[Help] Vehicle Destory


3B00DG4MER

Recommended Posts

Posted

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 
) 
  

SAF/SAO - 30%

Skype: Themerzoug2020

in-game name:3B00DG4MER

xOG7h1J.png

Posted

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 :(

SAF/SAO - 30%

Skype: Themerzoug2020

in-game name:3B00DG4MER

xOG7h1J.png

Posted

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 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
No, getPlayerTeam returns a team element, to get the name you must use
getTeamName ( getPlayerTeam ( thePlayer ) ) 

Now the Error is This

    local vehicleName = getVehicleName ( theVehicle ) 
            destroyElement( vehicleName ) 

Bad Argument

SAF/SAO - 30%

Skype: Themerzoug2020

in-game name:3B00DG4MER

xOG7h1J.png

Posted
Do you even know what does getVehicleName do?

it get name of the vehicle

Exactly. You can't destroy a vehicle name, thats not an element. Use Solidsnake's code, that should work.

His Code not work,and There is No bug with his code

SAF/SAO - 30%

Skype: Themerzoug2020

in-game name:3B00DG4MER

xOG7h1J.png

Posted

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 
) 

Posted

You should make the whole thing server side, because I'm not sure if it'll actually destroy it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
addEventHandler ( "onVehicleEnter", root, 
    function ( player ) 
        local team = getTeamName ( getPlayerTeam ( player ) ) 
        if ( team == "WhiteTeam" or team == "BlackTeam" ) then 
            destroyElement ( source ) 
        end 
    end 
) 

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...