Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add killPedTask function #3808

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

Proxy-99
Copy link
Contributor

@Proxy-99 Proxy-99 commented Oct 16, 2024

killPedTask(ped, string taskType, int taskNumber, [bool gracefully = true])

issue related #3806

exmaple kill jump task

function playerPressedKey(button, press)
       local moveState = getPedMoveState( localPlayer )

       if(moveState=="jump") then
           killPedTask(localPlayer, "primary", 3, true)
       end
end
addEventHandler("onClientKey", root, playerPressedKey)

@TracerDS
Copy link
Contributor

What would happen if you kill ped task while being in the air (complex jump tasks)?

@Proxy-99
Copy link
Contributor Author

Proxy-99 commented Oct 24, 2024

What would happen if you kill ped task while being in the air (complex jump tasks)?

u will fall stand still the animation will stop but you have to call it in each frame like onClientRender

function displayMyTask ()
killPedTask(localPlayer, "primary", 1)
    local x,y = 100,200
    for k=0,4 do
        local a,b,c,d = getPedTask ( localPlayer, "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 ( localPlayer, "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 )

@TracerDS
Copy link
Contributor

What would happen if you kill ped task while being in the air (complex jump tasks)?

u will fall stand still the animation will stop but you have to call it in each frame like onClientRender

Would you still continue the jump but without an animation or would the jump be cut off and instead of making the jump you will fall straight down?
Also, is it possible to also clear the task queue?

@Proxy-99
Copy link
Contributor Author

Proxy-99 commented Oct 24, 2024

What would happen if you kill ped task while being in the air (complex jump tasks)?

u will fall stand still the animation will stop but you have to call it in each frame like onClientRender

Would you still continue the jump but without an animation or would the jump be cut off and instead of making the jump you will fall straight down? Also, is it possible to also clear the task queue?

I do not know about jumping while in air do you mean jump after an object then fall in air?
I think the task queue is cleared once the task is killed or no task is active consider empty

@TracerDS
Copy link
Contributor

I do not know about jumping while in air do you mean jump after an object then fall in air? I think the task queue is cleared once the task is killed or no task is active consider empty

I mean, you jump then immediately after you kill the task. What would happen? Would the jump finish but without animation or would it freeze in the air for a small time and then fly straight down?

@Proxy-99
Copy link
Contributor Author

I do not know about jumping while in air do you mean jump after an object then fall in air? I think the task queue is cleared once the task is killed or no task is active consider empty

I mean, you jump then immediately after you kill the task. What would happen? Would the jump finish but without animation or would it freeze in the air for a small time and then fly straight down?

you better test it than explain 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants