SA-MP Forums Archive
Animations on chat - 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: Animations on chat (/showthread.php?tid=399953)



Animations on chat - ChristofferHoffmann - 16.12.2012

Hey.

I have the talk animations to the onplayertext, and it works fine so far.

However, I was wondering. How am I able to prevent the animations from activating if: Another animation is active, the player is crouched, and if the player is frozen?

Here's the code.

Код:
new AnimR = random(1);
	if(AnimR == 0 && !IsPlayerInAnyVehicle(playerid))
	{
    ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.0, 1, 0, 0, 1, 1);
    SetTimerEx("SpeakAnim", strlen(text)*150, false, "i", playerid);
	}
	else if(AnimR == 1 && !IsPlayerInAnyVehicle(playerid))
	{
    ApplyAnimation(playerid, "PED", "Idle_Chat_02", 4.0, 1, 0, 0, 1, 1);
    SetTimerEx("SpeakAnim", strlen(text)*150, false, "i", playerid);
	}



Re: Animations on chat - Mike_Peterson - 16.12.2012

If statements, now crouching is easy
https://sampwiki.blast.hk/wiki/GetPlayerSpecialAction
https://sampwiki.blast.hk/wiki/SpecialActions
thus 1 - SPECIAL_ACTION_DUCK * - Detect if the player is crouching.
I don't know a proper way of detecting if a player is frozen, i would say put a IsFrozen[playerid] variable at every TogglePlayerControllable line in ur script.
now to detect whether a different animation is active
Код:
if(GetPlayerAnimationIndex(playerid) != 0)
Anything left?


Re: Animations on chat - ChristofferHoffmann - 16.12.2012

Thanks man!