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 11 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 😅

@@ -41,6 +41,13 @@ enum
ABORT_PRIORITY_IMMEDIATE
};

enum taskType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be consistent with another code. eTaskType. It's not a part of hungarian notation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what letter e reference to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumeration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we can use hungarian notation with enums?
I mean I don't see any benefits of using that format

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we can use hungarian notation with enums? I mean I don't see any benefits of using that format

Using e for enumartion is not considered Hungarian notation, it's a different principle and a practiced used in all code

@TheNormalnij TheNormalnij added enhancement New feature or request feedback Further information is requested labels Nov 14, 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.

5 participants