xxldoener Posted June 2, 2012 Share Posted June 2, 2012 I wrote a script to Blow a vehicle a player is in by entering blowplayer *playername* However, this also blows all other cars spawned by that player, even if the player is not in them. How can I make that only the car the player is using right now is blown? function blowplayer (thePlayer, commandname, target) local targetp = getPlayerFromName (target) local root = getRootElement (targetp) if ( targetp ) then -- Wenn Spieler existiert und in Auto if getPedOccupiedVehicle(targetp) then blowVehicle ( root ) else outputChatBox("The selected Player is not in a vehicle", thePlayer) end else outputChatBox("Invalid player specified", thePlayer) end end addCommandHandler ( "blowplayer", blowplayer ) Link to comment
Castillo Posted June 3, 2012 Share Posted June 3, 2012 You're using getRootElement, that's wrong. function blowplayer ( thePlayer, commandname, target ) local targetp = getPlayerFromName ( target ) if ( targetp ) then -- Wenn Spieler existiert und in Auto if ( isPedInVehicle ( targetp) ) then -- If the target is on a vehicle .. blowVehicle ( getPedOccupiedVehicle ( targetp ) ) -- Blow his/her vehicle. else outputChatBox ( "The selected Player is not in a vehicle", thePlayer ) end else outputChatBox ( "Invalid player specified", thePlayer ) end end addCommandHandler ( "blowplayer", blowplayer ) Read comments. Link to comment
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