Jump to content

onClientPlayerWeaponFire for melee weapons


Skream

Recommended Posts

  • Discord Moderators

It clearly says on the wiki page:

Quote

This does not trigger for projectiles, melee weapons, or camera.

So, no, it doesnt, I'll add the note on the wiki page, so everyone will notice it.

Edited by Pirulax
Link to comment
  • Moderators

I am not sure, I hardly needed them.

 

Just run the example of the wiki, to figure our what you need.

https://wiki.multitheftauto.com/wiki/GetPedTask

Quote

 

Example

This example draws the active primary and secondary tasks (including task hierarchy in 1.1) as your local player moves around the world.

 

function displayMyTask ()
    local x,y = 100,200
    for k=0,4 do
        local a,b,c,d = getPedTask ( getLocalPlayer(), "primary", k )
        dxDrawText ( "Primary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y )
        y = y + 15
    end
    y = y + 15
    for k=0,5 do
        local a,b,c,d = getPedTask ( getLocalPlayer(), "secondary", k )
        dxDrawText ( "Secondary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y )    
        y = y + 15
    end
end    
addEventHandler ( "onClientRender", root, displayMyTask )

(x and y are screen positions)

(a, b, c, d  are the task information)

 


You can also use bindkey: https://wiki.multitheftauto.com/wiki/BindKey

But that doesn't tell you if a ped is actually doing the animation/task.

bindKey("fire", "down", function () end)

 

Edited by IIYAMA
  • Like 1
Link to comment
3 minutes ago, IIYAMA said:

I am not sure, I hardly needed them.

 

Just run the example of the wiki, to figure our what you need.

https://wiki.multitheftauto.com/wiki/GetPedTask


function displayMyTask ()
    local x,y = 100,200
    for k=0,4 do
        local a,b,c,d = getPedTask ( getLocalPlayer(), "primary", k )
        dxDrawText ( "Primary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y )
        y = y + 15
    end
    y = y + 15
    for k=0,5 do
        local a,b,c,d = getPedTask ( getLocalPlayer(), "secondary", k )
        dxDrawText ( "Secondary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y )    
        y = y + 15
    end
end    
addEventHandler ( "onClientRender", root, displayMyTask )

(x and y are screen positions)

(a, b, c, d  are the task information)

 


You can also use bindkey: https://wiki.multitheftauto.com/wiki/BindKey

But that doesn't tell you if a ped is actually doing the animation/task.


bindKey("fire", "down", function () end)

 

k my friend I'll do my job here. Thanks for your help. Yeah, bindkey seems a bad idea for this.

  • Like 1
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...