Jump to content

Hunter target


denny199

Recommended Posts

Posted

hi there I was wondering that some servers have liek this: a hunter fight; Danny hitted Joop with his hunter like that but how?

i maded like this: but when i shoot it comes test: and a error in debugscript:

ser bad argument 17: getelementtype but i wanna make if a player hits a another player with his rocket that it comes in the chatbox that he hitted him please help me ;-)

-- i know from wiki but i dnunno were to start

  
function onPlayerTarget ( targetElem ) 
    if getElementType ( targetElem ) == "vehicle" and getElementModel ( targetElem ) == 425 then 
outputChatBox ( "test" ) 
    end 
end 
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget )   

Sometimes I dream about cheese

Posted (edited)

Code Updated ! 2

local him = getPlayerName(killer) 
local me = getPlayerName(source) 
local what = getElementType() 
local mta = getElementModel() 
function kill ( ammo, killer, killerweapon, bodypart) 
    if (what == "vehicle" and mta == 425) then 
outputChatBox ( "him .. Has Killed .. me with .. what .. mta" ) 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), kill ) 

Edited by Guest

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

ofc,

If you have got a hunter fight

Like this:

I shoot you and you got killed by me then i will that in the chatbox comes: ( "Danny has killed Kennix with his hunter" )

Sometimes I dream about cheese

Posted

see my code updated !

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted
function kill ( ammo, killer, killerweapon, bodypart ) 
    local vehicle = getPedOccupiedVehicle( killer ) 
    if isElement( vehicle ) and getElementModel( vehicle ) == 425 then 
        outputChatBox ( getPlayerName( killer )..' has killed '..getPlayerName( source )..' with his hunter.' ) 
    end 
end 
addEventHandler ( "onPlayerWasted", root, kill ) 

Evil-Cod3r,Your code is wrong.

local him = getPlayerName(killer) -- variable killer is nil 
local me = getPlayerName(source) -- variable source is nil ( source used in event you can read [url=https://wiki.multitheftauto.com/wiki/Predefined_variables_list]https://wiki.multitheftauto.com/wiki/Pre ... ables_list[/url] ) 
local what = getElementType() -- not use arguments so return false 
local mta = getElementModel() -- same 
function kill ( ammo, killer, killerweapon, bodypart) 
    if (what == "vehicle" and mta == 425) then 
outputChatBox ( "him .. Has Killed .. me with .. what .. mta" ) 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), kill ) 

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

oh sorrey thanks for the lesson :)

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

it says bad argument @ getpecoccupiedvehicle used this code

function kill ( ammo, killer, killerweapon, bodypart ) 
    local vehicle = getPedOccupiedVehicle( killer ) 
    if isElement( vehicle ) and getElementModel( vehicle ) == 425 then 
        outputChatBox ( getPlayerName( killer )..' has killed '..getPlayerName( source )..' with his hunter.' ) 
    end 
end 
addEventHandler ( "onPlayerWasted", root, kill ) 

Sometimes I dream about cheese

Posted (edited)
function kill ( ammo, killer, killerweapon, bodypart ) 
    if killer and killer ~= source then 
        if isPedInVehicle( killer ) and killerweapon == 19 or killerweapon == 51 then 
            local vehicle = getPedOccupiedVehicle( killer ) 
            if isElement( vehicle ) and getElementModel( vehicle ) == 425 then 
                outputChatBox ( getPlayerName( killer )..' has killed '..getPlayerName( source )..' with his hunter.' ) 
            end 
        end  
    end  
end 
addEventHandler ( "onPlayerWasted", root, kill ) 

Updated.

You need for race gm?

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
well, kenix code didn't work it does nothing now i saw the updated, thanks for that but it's now serverside

My code is wrong I actually was realized.

We can't get who create projectile.

I think better request parameter attacker for event onVehicleExplode in bug tracker.

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
function projectileCreation() 
    local target = getProjectileTarget(source) 
    if (target and getElementType(target) == "vehicle" and getVehicleController(target)) then 
        local player = getVehicleController(target) 
        outputChatBox(getPlayerName(player)) 
    end 
end 
addEventHandler("onClientProjectileCreation", getRootElement(), projectileCreation) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

That's like a example, if the rocket has a target and the target is a vehicle and the vehicle has a driver, then output it's name to the client.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

Client

addEventHandler( "onClientProjectileCreation", root,  
    function( creator ) 
        local target = getProjectileTarget( source ) 
        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 
) 

Server

addEvent( 'onVehicleExploded',true ) 
addEventHandler( 'onVehicleExploded',root, 
    function( attacker ) 
        outputChatBox ( getPlayerName( attacker )..' has killed '..getPlayerName( source )..' with his hunter.',root,255,0,0 ) 
    end 
)    

Updated again.

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Try again.

And check each row with outputChatBox/outputDebugString.

Maybe projectile creator is player ( not vehicle ).

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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