SA-MP Forums Archive
Keep animation while talking - 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: Keep animation while talking (/showthread.php?tid=470863)



Keep animation while talking - bzwski - 20.10.2013

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;
}



Re: Keep animation while talking - Jankingston - 20.10.2013

add new animation

PS > think its impossible


Respuesta: Keep animation while talking - bzwski - 20.10.2013

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

Anyone?


Re: Keep animation while talking - denNorske - 20.10.2013

EDIT: Looks like i was wrong. (Removed)


Respuesta: Keep animation while talking - bzwski - 20.10.2013

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.


Re: Keep animation while talking - rickisme - 20.10.2013

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;
}



Respuesta: Keep animation while talking - bzwski - 20.10.2013

Thanks rickisme, it worked.