Trust aka Tiffergan Posted May 15, 2020 Share Posted May 15, 2020 (edited) So i have this code, and this code work great, but when i will die and i will respawn i have still animations even if my ID skin is not 78 or 76 so what i need add there that will set my player animation on 0 when im respawning? function informPlayerOnModelChange(oldModel, newModel) if ( getElementType(source) == "player" ) then skin = getPedSkin(localPlayer) if skin == 78 or skin == 76 then setPedWalkingStyle(localPlayer,59) else setPedWalkingStyle(localPlayer,0) end end return end addEventHandler("onClientElementModelChange", root, informPlayerOnModelChange) Edited May 15, 2020 by LOOah Link to comment
Moderators Patrick Posted May 15, 2020 Moderators Share Posted May 15, 2020 Change back at onClientPlayerSpawn event. addEventHandler("onClientPlayerSpawn", localPlayer, function() setPedWalkingStyle(source, 0) end) 1 Link to comment
Trust aka Tiffergan Posted May 15, 2020 Author Share Posted May 15, 2020 o thanks it works, i was trying using OnPlayerSpawn and that was not working Link to comment
Moderators Patrick Posted May 15, 2020 Moderators Share Posted May 15, 2020 28 minutes ago, LOOah said: o thanks it works, i was trying using OnPlayerSpawn and that was not working because onPlayerSpawn is a server-sided event, you can't use it on client-side. Link to comment
#\_oskar_/# Posted May 15, 2020 Share Posted May 15, 2020 4 hours ago, LOOah said: So i have this code, and this code work great, but when i will die and i will respawn i have still animations even if my ID skin is not 78 or 76 so what i need add there that will set my player animation on 0 when im respawning? function informPlayerOnModelChange(oldModel, newModel) if ( getElementType(source) == "player" ) then skin = getPedSkin(localPlayer) if skin == 78 or skin == 76 then setPedWalkingStyle(localPlayer,59) else setPedWalkingStyle(localPlayer,0) end end return end addEventHandler("onClientElementModelChange", root, informPlayerOnModelChange) Change getPedSkin to getElementModel Link to comment
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