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

Merged
merged 13 commits into from
Dec 21, 2024
Merged

add killPedTask function #3808

merged 13 commits into from
Dec 21, 2024

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)

@Proxy-99 Proxy-99 requested a review from TracerDS October 16, 2024 21:29
@Proxy-99 Proxy-99 requested a review from TheNormalnij October 18, 2024 22:36
@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 😅

@TheNormalnij TheNormalnij added enhancement New feature or request feedback Further information is requested labels Nov 14, 2024
@Dutchman101 Dutchman101 merged commit e4a502b into multitheftauto:master Dec 21, 2024
6 checks passed
@Dutchman101
Copy link
Member

Thanks, please add it to wiki
@Proxy-99

@botder botder added this to the 1.6.1 milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants