SA-MP Forums Archive
[HELP]IDLE_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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]IDLE_CHAT (/showthread.php?tid=114462)



[HELP]IDLE_CHAT - Lilcuete - 19.12.2009

Ok how can i make so when they talk there hands move like for example if they say "yo how are you doing" ingame there hands will move for 5seconds and if they say "yo" there hands will move for 2seconds please tell me how heres my code
Код:
 	if (realchat)
	{
	  if(gPlayerLogged[playerid] == 0)
	  {
	    return 0;
   	}
		GetPlayerName(playerid, sendername, sizeof(sendername));
		if(!IsPlayerInAnyVehicle(playerid))
		{
			if(PlayerInfo[playerid][pMaskuse] == 1)
			{
				format(string, sizeof(string), "Mask_12302 Says: %s", text);
		
				ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			}
			else
			{
		  	format(string, sizeof(string), "%s Says: %s", sendername, text);
		 
		  	ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  	ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			}
		}
		else
		{
		  new carid = GetPlayerVehicleID(playerid);
		  new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
		  if(IsABike(carid) || IsAOBike(carid) || IsAPizzabike(carid) || IsAPlane(carid) || IsABoat(carid) || IsASweeper(carid) || IsAHarvest(carid) || IsADrugHarvest(carid) || IsATank(carid) || pveh == 523 || pveh == 480 || pveh == 567 || pveh == 533 || pveh == 555 || pveh == 539 || pveh == 572 || pveh == 571 || pveh == 530 || pveh == 457 || pveh == 575 || pveh == 536 || pveh == 424)
		  {
		    if(PlayerInfo[playerid][pMaskuse] == 1)
				{
					format(string, sizeof(string), "Mask_12302 Says: %s", text);
			
					ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
					ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				}
				else
				{
				
		  		format(string, sizeof(string), "%s Says: %s", sendername, text);
		  		ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				}
		  }
		  else
		  {
		  	if(VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
		  	{
		  		if(PlayerInfo[playerid][pMaskuse] == 1)
					{
						format(string, sizeof(string), "(Windows Shut) Stranger Says: %s", text);
						ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
						ProxDetector(10.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
					else
					{
		  			format(string, sizeof(string), "(Windows Shut) %s Says: %s", sendername, text);
		  			ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  			ProxDetector(10.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
				}
				else
				{
			  	if(PlayerInfo[playerid][pMaskuse] == 1)
					{
						format(string, sizeof(string), "(Windows Open) Mask_12302 Says: %s", text);
						ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
						ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
					else
					{
		  			format(string, sizeof(string), "(Windows Open) %s Says: %s", sendername, text);
		  			ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  			ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
				}
			}
		}
		return 0;
	}
	return 1;
}



Re: [HELP]IDLE_CHAT - _[HuN]_Epsilon_ - 19.12.2009

http://forum.sa-mp.com/index.php?topic=138372.0


Re: [HELP]IDLE_CHAT - Lilcuete - 19.12.2009

Ok still doesnt work
Код:
	if (realchat)
	{
	  if(gPlayerLogged[playerid] == 0)
	  {
	    return 0;
   	}
		GetPlayerName(playerid, sendername, sizeof(sendername));
		if(!IsPlayerInAnyVehicle(playerid))
		{
			if(PlayerInfo[playerid][pMaskuse] == 1)
			{
				format(string, sizeof(string), "Mask_12302 Says: %s", text);
		
				ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0,3000);
				SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			}
			else
			{
		  	format(string, sizeof(string), "%s Says: %s", sendername, text);
		 
		  	ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  	SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
		  	ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
			}
		}
		else
		{
		  new carid = GetPlayerVehicleID(playerid);
		  new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
		  if(IsABike(carid) || IsAOBike(carid) || IsAPizzabike(carid) || IsAPlane(carid) || IsABoat(carid) || IsASweeper(carid) || IsAHarvest(carid) || IsADrugHarvest(carid) || IsATank(carid) || pveh == 523 || pveh == 480 || pveh == 567 || pveh == 533 || pveh == 555 || pveh == 539 || pveh == 572 || pveh == 571 || pveh == 530 || pveh == 457 || pveh == 575 || pveh == 536 || pveh == 424)
		  {
		    if(PlayerInfo[playerid][pMaskuse] == 1)
				{
					format(string, sizeof(string), "Mask_12302 Says: %s", text);
			
					ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
					SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
					ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				}
				else
				{
				
		  		format(string, sizeof(string), "%s Says: %s", sendername, text);
		  		ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  		SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
		  		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				}
		  }
		  else
		  {
		  	if(VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
		  	{
		  		if(PlayerInfo[playerid][pMaskuse] == 1)
					{
						format(string, sizeof(string), "(Windows Shut) Stranger Says: %s", text);
						ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
						SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
						ProxDetector(10.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
					else
					{
		  			format(string, sizeof(string), "(Windows Shut) %s Says: %s", sendername, text);
		  			ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 3000);
		  			SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
		  			ProxDetector(10.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
				}
				else
				{
			  	if(PlayerInfo[playerid][pMaskuse] == 1)
					{
						format(string, sizeof(string), "(Windows Open) Mask_12302 Says: %s", text);
						ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 0);
						SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
						ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
					else
					{
		  			format(string, sizeof(string), "(Windows Open) %s Says: %s", sendername, text);
		  			ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0, 0);
		  			SetTimerEx("StopTalk",floatround(strlen(text)/9)*1000, 0, "i", playerid);
		  			ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
					}
				}
			}
		}
		return 0;
	}
	return 1;
}



Re: [HELP]IDLE_CHAT - patchkinson - 19.12.2009

on top of script:
pawn Код:
forward anim(playerid);
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "yo") != -1)
  {
    ApplyAnimation(playerid, "PED", "IDLE_chat", 4.1, 0, 1, 1, 0,3000);
    SetTimerEx("anim", 2000, false, "i", playerid); //THANKS FOR DON CORRELI FOR THIS SETTIMEREX!

  }
  return 1;
and for settimerex i used the wiki cose i have only used settime till now so if there's any problem with it, ya know ima noob that had to check the wiki xD lol
then create this callback:
pawn Код:
public anim(playerid)
{
  ClearAnimations(playerid);
  return 1;
}
i didnt test anything but i think it works!


Re: [HELP]IDLE_CHAT - Correlli - 19.12.2009

Quote:
Originally Posted by patchkinson
pawn Код:
SetTimerEx("anim", 2000, false, "is", 1, "string to pass");
And why would you want to pass a string if the function anim has only an integer value which is playerid.
+ why just for player with ID 1?


Re: [HELP]IDLE_CHAT - patchkinson - 19.12.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by patchkinson
pawn Код:
SetTimerEx("anim", 2000, false, "is", 1, "string to pass");
And why would you want to pass a string if the function anim has only an integer value which is playerid.
as i stated im a lil noob and i never used SetTimerEx so i had to see the wiki, till now i only used SetTimer, can you please correct my SetTimerEx ?
Thanks !


Re: [HELP]IDLE_CHAT - Correlli - 19.12.2009

Quote:
Originally Posted by patchkinson
can you please correct my SetTimerEx ?
pawn Код:
SetTimerEx("anim", 2000, false, "i", playerid);



Re: [HELP]IDLE_CHAT - patchkinson - 19.12.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by patchkinson
can you please correct my SetTimerEx ?
pawn Код:
SetTimerEx("anim", 2000, false, "i", playerid);
hehe thanks for correcting me. you helped me and him, im going to put your settimerex in my example but give you credits for it, if you dont want me to put it in my example, please tell me!


Re: [HELP]IDLE_CHAT - Correlli - 19.12.2009

Quote:
Originally Posted by patchkinson
hehe thanks for correcting me. you helped me and him, im going to put your settimerex in my example but give you credits for it, if you dont want me to put it in my example, please tell me!
You don't need to give me any credits, it's just a code correction.


Re: [HELP]IDLE_CHAT - patchkinson - 19.12.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by patchkinson
hehe thanks for correcting me. you helped me and him, im going to put your settimerex in my example but give you credits for it, if you dont want me to put it in my example, please tell me!
You don't need to give me any credits, it's just a code correction.
but you helped