SA-MP Forums Archive
Animation doesn't work on spawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Animation doesn't work on spawn (/showthread.php?tid=651866)



Animation doesn't work on spawn - IndependentGaming - 29.03.2018

Hello, I try to let the player move with a animation for 7 seconds on register spawn here is the code:

Nothing happens player doesn't move.

PHP код:
TogglePlayerSpectating(playeridfalse);
            
SetPlayerPos(playerid4602.7427190.89279.3325);
            
SetPlayerFacingAngle(playerid22.1796);
            
ApplyAnimation(playerid"PED""WALK_gang2"4.0011071);
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]);
            
SetPlayerInterior(playerid0);
            
SetPlayerVirtualWorld(playerid0);
            
SetHealth(playerid100);
            
PlayerInfo[playerid][pLevel]= 5;
            
ClearChatbox(playerid); 



Re: Animation doesn't work on spawn - IndependentGaming - 29.03.2018

Anyone ?


Re: Animation doesn't work on spawn - IndependentGaming - 29.03.2018

I manged to stream the objects but for some reason the animation doesn't work I really have no idea why

PHP код:
TogglePlayerSpectating(playeridfalse);
            
SetPlayerPos(playerid4602.7427190.89279.3325);
            
Player_StreamPrep(playerid4602.7427190.89279.3325FREEZE_TIME);
            
SetPlayerFacingAngle(playerid22.1796);
            
ApplyAnimation(playerid"PED""WALK_gang2"4.0111111);
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]);
            
SetPlayerInterior(playerid0);
            
SetPlayerVirtualWorld(playerid0);
            
SetHealth(playerid100);
            
PlayerInfo[playerid][pConnectHours] = 30;
            
ClearChatbox(playerid); 



Re: Animation doesn't work on spawn - YenTy - 29.03.2018

If you didn't tried then apply animations twice.


Re: Animation doesn't work on spawn - IndependentGaming - 29.03.2018

Quote:
Originally Posted by YenTy
Посмотреть сообщение
If you didn't tried then apply animations twice.
Tried that as well still animation doesn't apply..


Re: Animation doesn't work on spawn - YenTy - 29.03.2018

Well I think I see it now, you're applying skin after apply an animations. It can cause a animations clearing. You've to set skin before any next animation step.


Re: Animation doesn't work on spawn - IndependentGaming - 29.03.2018

Quote:
Originally Posted by YenTy
Посмотреть сообщение
Well I think I see it now, you're applying skin after apply an animations. It can cause a animations clearing. You've to set skin before any next animation step.
Placed it under the code and it still doesn't apply


Re: Animation doesn't work on spawn - YenTy - 29.03.2018

I've put your code under /test cmd and everything including changing skin after animations works fine. I find out that if position of character is too high or too low then after fall animation is not more used. Are cords good for sure?


Re: Animation doesn't work on spawn - UFF - 30.03.2018

You can use Switch case

Код:
            TogglePlayerSpectating(playerid, false);
            SetPlayerPos(playerid, 4602.7427, 190.8927, 9.3325);
            Player_StreamPrep(playerid, 4602.7427, 190.8927, 9.3325, FREEZE_TIME);
            SetPlayerFacingAngle(playerid, 22.1796);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            SetHealth(playerid, 100);
            PlayerInfo[playerid][pConnectHours] = 30;
            ClearChatbox(playerid);  

	switch (classid)
	{

		case 0:
		{
		       //skin 270 with Dance Animation
			ApplyAnimation(playerid, "DANCING", "DNCE_M_A", 4.1, 1, 1, 1, 1, 1);
		}
                return 1;
       }
Set these according to your OnGamemodeInit Skins.