Tails Posted August 25, 2012 Share Posted August 25, 2012 Hi guys. I am attempting to edit a little part of the Admin script in MTA. What I want is instead of /slap the players health but the players vehicle health. Is there a way to edit the script below so that it does? This is the part of the script: elseif ( action == "slap" ) then if ( getElementHealth ( player ) > 0 ) and ( not isPedDead ( player ) ) then if ( ( not data ) or ( not tonumber ( data ) ) ) then data = 20 end if ( ( tonumber ( data ) >= 0 ) ) then if ( tonumber ( data ) > getElementHealth ( player ) ) then setTimer ( killPed, 50, 1, player ) else setElementHealth ( player, getElementHealth ( player ) - data ) end local x, y, z = getElementVelocity ( player ) setElementVelocity ( player, x , y, z + 0.2 ) mdata = data else action = nil end Thanks in advance! Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 You can check if the target is on a vehicle with: isPedOnVehicle, and if he/she is, then get his/her vehicle with: getPedOccupiedVehicle. Link to comment
Tails Posted August 25, 2012 Author Share Posted August 25, 2012 I'm sorry I am still a complete noob. How would I add that into that complicated script? Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 elseif ( action == "slap" ) then local vehicle = getPedOccupiedVehicle ( player ) local theElement = ( vehicle and vehicle or player ) if ( getElementHealth ( theElement ) > 0 ) then if ( getElementType ( theElement ) == "player" and not isPedDead ( theElement ) ) or ( getElementType ( theElement ) == "vehicle" and not isVehicleBlown ( theElement ) ) then if ( ( not data ) or ( not tonumber ( data ) ) ) then data = 20 end if ( ( tonumber ( data ) >= 0 ) ) then if ( tonumber ( data ) > getElementHealth ( theElement ) ) then if ( getElementType ( theElement ) == "player" ) then setTimer ( killPed, 50, 1, theElement ) else setTimer ( blowVehicle, 50, 1, theElement ) end else setElementHealth ( theElement, getElementHealth ( theElement ) - data ) end local x, y, z = getElementVelocity ( theElement ) setElementVelocity ( theElement, x , y, z + 0.2 ) mdata = data else action = nil end else action = nil end else action = nil end Link to comment
Tails Posted August 26, 2012 Author Share Posted August 26, 2012 Thanks you very very much 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