Keep animation while talking
#1

Hi guys, I'm trying to make the player remain with the animation while he types e.g. being sit. However, it stands up and does the chat animation.

Sit animation:

Код:
COMMAND:sit(playerid, params[])
{
	new style;
    if(PlayerStat[playerid][Tased] == 1 || PlayerStat[playerid][Cuffed] == 1)
	{
 	SendClientMessage(playerid, GREY, "No puedes usar esta animaciуn ahora.");
	}
	if(sscanf(params,"d", style))return SendClientMessage(playerid, GREY, "USO: /sit [style 1-2]");
	switch(style)
	{
		case 1: ApplyLoopingAnimation(playerid, "PED", "SEAT_idle", 4.0, 1, 0, 0, 0, 0);
		case 2: ApplyLoopingAnimation(playerid, "BEACH", "ParkSit_M_loop", 4.0, 1, 0, 0, 0, 0);
	}
    return 1;
}
Chat:

Код:
public OnPlayerText(playerid, text[])
{
    IRC_GroupSayEx(gGroupID, IRC_AECHO_CHANNEL, "7[chat] 3%s (%d): %s", pNick(playerid), playerid, text);
	new str[128];
    if(PlayerStat[playerid][Logged] == 0)
	{
		SendClientMessage(playerid, GREY, "Tienes que estar logeado.");
		return 0;
	}
	if(Server[CurrentGMX] >= 1)
	{
		SendClientMessage(playerid, GREY, "Espera a que el servidor se haya reinciado por completo.");
		return 0;
	}
	if(PlayerStat[playerid][FullyRegistered] == 0)
	{
		SendClientMessage(playerid, GREY, "Tienes que aсadir informaciуn de tu personaje.");
		return 0;
	}
	if(PlayerStat[playerid][Spawned] == 0)
	{
		SendClientMessage(playerid, GREY, "Tienes que estar dentro del servidor para hablar.");
		return 0;
	}
	if(PlayerStat[playerid][Muted] == 1)
	{
		format(str, sizeof(str), "No puedes hablar, estбs muteado, tienes que esperar %d segundos.", PlayerStat[playerid][MuteTime]);
		SendClientMessage(playerid, GREY, str);
		return 0;
	}
	else
	{
	    format(str, sizeof(str), "%s dice: %s", GetICName(playerid), text);
		SendNearByMessage(playerid, WHITE, str, 5);
		ICLog(str);
		new Length = strlen(text);
        new TalkTime = Length*100;
        ApplyAnimation(playerid,"PED","IDLE_chat", 4.1, 0, 0, 0, 1, 1);
        KillTimer(Server[StopTalkingAnimation]);
        Server[StopTalkingAnimation] = SetTimerEx("StopTalkingAnim", TalkTime, 0, "d", playerid);
	}
	return 0;
}
Reply
#2

add new animation

PS > think its impossible
Reply
#3

No it's not, I've seen it in many servers.

Anyone?
Reply
#4

EDIT: Looks like i was wrong. (Removed)
Reply
#5

No, I don't want that. I just want to remain doing the animation while the player types even when he's sit, laying, peeing, etc.
Reply
#6

try this
pawn Код:
public OnPlayerText(playerid, text[])
{
    IRC_GroupSayEx(gGroupID, IRC_AECHO_CHANNEL, "7[chat] 3%s (%d): %s", pNick(playerid), playerid, text);
    new str[128];
    if(PlayerStat[playerid][Logged] == 0)
    {
        SendClientMessage(playerid, GREY, "Tienes que estar logeado.");
        return 0;
    }
    if(Server[CurrentGMX] >= 1)
    {
        SendClientMessage(playerid, GREY, "Espera a que el servidor se haya reinciado por completo.");
        return 0;
    }
    if(PlayerStat[playerid][FullyRegistered] == 0)
    {
        SendClientMessage(playerid, GREY, "Tienes que aсadir informaciуn de tu personaje.");
        return 0;
    }
    if(PlayerStat[playerid][Spawned] == 0)
    {
        SendClientMessage(playerid, GREY, "Tienes que estar dentro del servidor para hablar.");
        return 0;
    }
    if(PlayerStat[playerid][Muted] == 1)
    {
        format(str, sizeof(str), "No puedes hablar, estбs muteado, tienes que esperar %d segundos.", PlayerStat[playerid][MuteTime]);
        SendClientMessage(playerid, GREY, str);
        return 0;
    }
    else
    {
       
        format(str, sizeof(str), "%s dice: %s", GetICName(playerid), text);
        SendNearByMessage(playerid, WHITE, str, 5);
        ICLog(str);
        if(GetPlayerAnimationIndex(playerid)) // if player in vehicle this will be return 0
        {
            new animlib[32];
            new animname[32];
            GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
            if(!strcmp(animlib, "PED", true) && !strcmp(animname, "IDLE_STANCE", true))
            {
                new Length = strlen(text);
                new TalkTime = Length*100;
                ApplyAnimation(playerid,"PED","IDLE_chat", 4.1, 0, 0, 0, 1, 1);
                KillTimer(Server[StopTalkingAnimation]);
                Server[StopTalkingAnimation] = SetTimerEx("StopTalkingAnim", TalkTime, 0, "d", playerid);
            }
        }
           
    }
    return 0;
}
Reply
#7

Thanks rickisme, it worked.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)