Evil-Cod3r Posted February 12, 2012 Share Posted February 12, 2012 (edited) Try This function kill ( killer, killerweapon, bodypart ) local vehicle = getPedOccupiedVehicle ( killer ) if isPedInVehicle ( killer ) and getElementModel ( vehicle ) == 425 then outputChatBox ( getPlayerName( killer ).." Has Killed ".. getPlayerName( source ).." with His Hunter .") end end addEventHandler ( "onPlayerWasted", getRootElement(), kill ) Edited February 12, 2012 by Guest Link to comment
Al3grab Posted February 12, 2012 Share Posted February 12, 2012 There's no really way to know who shoot you, because you get killed caused by your vehicle explosion, not by the rocket fired.I don't know if "onClientVehicleCollision" detects the rocket, and if you're able to track the projectile creator. maybe "onClientProjectileCreation" getProjectileCreator Link to comment
TwiX! Posted February 12, 2012 Share Posted February 12, 2012 Try This function kill ( ammo, killer, killerweapon, bodypart ) local vehicle = getPedOccupiedVehicle ( killer ) if isPedInVehicle ( killer ) and getElementModel ( vehicle ) == 425 then outputChatBox ( getPlayerName( killer ).." Has Killed ".. getPlayerName( source ).." with His Hunter .") end end addEventHandler ( "onPlayerWasted", getRootElement(), kill ) have errors Link to comment
Evil-Cod3r Posted February 12, 2012 Share Posted February 12, 2012 updated try again and give me the errors Link to comment
TwiX! Posted February 12, 2012 Share Posted February 12, 2012 updated try again and give me the errors im try it with another system. cause onPlayerWasted not work for this, but i lost code ;3 Link to comment
Castillo Posted February 12, 2012 Share Posted February 12, 2012 @Evil-Codr: What part didn't you understand of my first reply? the player get's killed by vehicle explosion, there's no way to detect if it was a hunter and the killer. Link to comment
Evil-Cod3r Posted February 13, 2012 Share Posted February 13, 2012 Oh sorry Man My bad Link to comment
denny199 Posted February 13, 2012 Author Share Posted February 13, 2012 hi there I'm back i changed the code a little bit but now i got a error @ getProjectileTarget;mayby should i use costum rockets? addEventHandler( "onClientProjectileCreation", root, function( creator ) car = getPedOccupiedVehicle ( player ) local target = getProjectileTarget( car ) if isElement( target ) and getElementType( target ) == 'vehicle' and isElement( creator ) and getElementType( creator ) == 'vehicle' then local attacker = getVehicleController( creator ) local player = getVehicleController( target ) if isElement( attacker ) and isElement( player ) then triggerServerEvent( 'onVehicleExploded',player,attacker ) end end end ) [ i added car and changed it getProjectileTarget to car ] Link to comment
Kenix Posted February 13, 2012 Share Posted February 13, 2012 Client local attacker,player addEventHandler( "onClientProjectileCreation", root, function( creator ) local target = getProjectileTarget( source ) if isElement( target ) and getElementType( target ) == 'vehicle' and isElement( creator ) and getElementType( creator ) == 'vehicle' then outputChatBox 'target == vehicle and creator == vehicle' attacker = getVehicleController( creator ) player = getVehicleController( target ) if isElement( attacker ) and isElement( player ) then outputChatBox 'trigger server event onVehicleExploded' triggerServerEvent( 'onVehicleExploded',player,attacker ) end else outputChatBox 'target ~= vehicle or creator ~= vehicle' outputChatBox( ' target = '..tostring( getElementType( target ) )..'\n\ creator = '..tostring( getElementType( creator ) )..'\n'.. 'attacker = '..tostring( getVehicleController( creator ) )..'\n'.. 'player = '..tostring( getVehicleController( target ) )..'' ) end end ) Server addEvent( 'onVehicleExploded',true ) addEventHandler( 'onVehicleExploded',root, function( attacker ) outputChatBox ( getPlayerName( attacker )..' has killed '..getPlayerName( source )..' with his hunter.',root,255,0,0 ) end ) Link to comment
denny199 Posted February 13, 2012 Author Share Posted February 13, 2012 target ~= vehicle or creator ~= vehicle target = false creator = vehicle attacker = userdata: 0000018E player = false target ~= vehicle or creator ~= vehicle target = false creator = vehicle attacker = userdata: 0000018E player = false ^^^^^^^^^^^^^^^^^^ i had a full target... without a target | \/ creator = vehicle attacker = userdata: 0000018E player = false target ~= vehicle or creator ~= vehicle target = false creator = vehicle attacker = userdata: 0000018E player = false Link to comment
denny199 Posted February 14, 2012 Author Share Posted February 14, 2012 so it doesn't get the target EDIT** sorry for double post 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