Sign in to follow this  
LOOah

Animations on spawn HELP

Recommended Posts

Posted (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 by LOOah

Share this post


Link to post

Change back at onClientPlayerSpawn event.

addEventHandler("onClientPlayerSpawn", localPlayer, function()
	setPedWalkingStyle(source, 0)
end)

 

  • Thanks 1

Share this post


Link to post

o thanks it works, i was trying using OnPlayerSpawn and that was not working 

Share this post


Link to post
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.

Share this post


Link to post
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

 

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.