PDA

View Full Version : Keep animation while talking


bzwski
20/10/2013, 02:45 AM
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;
}

Jankingston
20/10/2013, 03:46 AM
add new animation

PS > think its impossible

bzwski
20/10/2013, 10:09 AM
No it's not, I've seen it in many servers.

Anyone?

denNorske
20/10/2013, 10:53 AM
EDIT: Looks like i was wrong. (Removed)

bzwski
20/10/2013, 11:01 AM
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.

rickisme
20/10/2013, 11:40 AM
try this

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

bzwski
20/10/2013, 11:51 AM
Thanks rickisme, it worked.