Jump to content

Hunter target


denny199

Recommended Posts

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 by Guest
Link to comment
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
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

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

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

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

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