sphinx-dev-oss Posted December 28, 2022 Posted December 28, 2022 Hi everyone! I'm making a medic system that can revive another player. So i want to stop the player animation. I saw on wiki and forum the solution setPedAnimation(source) then i used it but the animation is not stopped and i got a error. Debugscript 3: WARNING: [Core]\cz_injury\revive.lua:57: Bad argument @ 'setPedAnimation' [Expected element at argument 1, got nil] This is my revive.lua (server sided): function reviveFunction() if (getElementData(testped, "playerDown") == true) then local thePlayerElem = getElementType(source) if(thePlayerElem == "player") then setPedAnimation(source, "bomber", "bom_plant_loop", -1, true, false, true, false, 150) setTimer(function() setPedAnimation(testped) setElementHealth(testped, 50) setPedAnimation(player) -- this is what stop the player animation end, 10000, 1) end end end addEvent("startRevive",true) addEventHandler("startRevive", getRootElement(), reviveFunction) Thanks for all reply! My Website: https://sphinx-dev-oss.nhely.hu My GitLab Profile: https://gitlab.com/sphinx-dev-oss My GitHub Profile: https://github.com/sphinx-dev-oss/ “It’s not a bug; it’s an undocumented feature.”
eoL Shady Posted December 28, 2022 Posted December 28, 2022 hello welcome to the forum i checked your code and made some changes, you didn't edit the timer to source,you can test. function reviveFunction() if (getElementData(testped, "playerDown") == true) then local thePlayerElem = getElementType(source) if(thePlayerElem == "player") then setPedAnimation(source, "bomber", "bom_plant_loop", -1, true, false, true, false, 150) setTimer(function(source) setPedAnimation(testped) setElementHealth(testped, 50) setPedAnimation(source) end, 10000, 1, source) -- pass source to timer end end end addEvent("startRevive",true) addEventHandler("startRevive", getRootElement(), reviveFunction) have a nice day. 1
sphinx-dev-oss Posted December 28, 2022 Author Posted December 28, 2022 3 minutes ago, Shady1 said: hello welcome to the forum i checked your code and made some changes, you didn't edit the timer to source,you can test. function reviveFunction() if (getElementData(testped, "playerDown") == true) then local thePlayerElem = getElementType(source) if(thePlayerElem == "player") then setPedAnimation(source, "bomber", "bom_plant_loop", -1, true, false, true, false, 150) setTimer(function(source) setPedAnimation(testped) setElementHealth(testped, 50) setPedAnimation(source) end, 10000, 1, source) -- pass source to timer end end end addEvent("startRevive",true) addEventHandler("startRevive", getRootElement(), reviveFunction) have a nice day. Thank you for the reply. Your change is working good. Thanks for the help! @Shady1 My Website: https://sphinx-dev-oss.nhely.hu My GitLab Profile: https://gitlab.com/sphinx-dev-oss My GitHub Profile: https://github.com/sphinx-dev-oss/ “It’s not a bug; it’s an undocumented feature.”
eoL Shady Posted December 28, 2022 Posted December 28, 2022 (edited) you're welcome, if you have a question, please create a new topic and tag me 2 minutes ago, SphinxDev said: Thank you for the reply. Your change is working good. Thanks for the help! @Shady1 Edited December 28, 2022 by Shady1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now