3B00DG4MER Posted March 17, 2014 Posted March 17, 2014 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 )
Castillo Posted March 17, 2014 Posted March 17, 2014 getTeamName requires a team element, use getPlayerTeam to obtain the team element.
3B00DG4MER Posted March 17, 2014 Author Posted March 17, 2014 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
Castillo Posted March 17, 2014 Posted March 17, 2014 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 )
3B00DG4MER Posted March 17, 2014 Author Posted March 17, 2014 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
3B00DG4MER Posted March 17, 2014 Author Posted March 17, 2014 Do you even know what does getVehicleName do? it get name of the vehicle
pa3ck Posted March 17, 2014 Posted March 17, 2014 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.
3B00DG4MER Posted March 18, 2014 Author Posted March 18, 2014 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
Chickelon12 Posted March 18, 2014 Posted March 18, 2014 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 )
Castillo Posted March 18, 2014 Posted March 18, 2014 You should make the whole thing server side, because I'm not sure if it'll actually destroy it.
WhoAmI Posted March 18, 2014 Posted March 18, 2014 addEventHandler ( "onVehicleEnter", root, function ( player ) local team = getTeamName ( getPlayerTeam ( player ) ) if ( team == "WhiteTeam" or team == "BlackTeam" ) then destroyElement ( source ) 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