SA-MP Forums Archive
OnPlayerKeyStateChange - 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: OnPlayerKeyStateChange (/showthread.php?tid=497608)



OnPlayerKeyStateChange - AroseKhanNiazi - 27.02.2014

Код:
if(newkeys == KEY_FIRE)
    {
	   if(sit[playerid] == 1)
	   {
	   sit[playerid] =0;
	   ApplyAnimation(playerid,"FIGHT_C","FightC_M",5,0,0,0,0,0);
	   ClearAnimations(playerid);
	   }
    }
warning
Код:
(12266) : warning 202: number of arguments does not match definition
and if i do this my game crashes
the line 12266 is
Код:
ClearAnimations(playerid);



Re: OnPlayerKeyStateChange - alishvasis - 27.02.2014

You Dont Need Clear Animation Just Change 5 to 0 Use this

Код:
ApplyAnimation(playerid,"FIGHT_C","FightC_M",0,0,0,0,0,0);
Rep Me TnX


Re: OnPlayerKeyStateChange - AroseKhanNiazi - 27.02.2014

i need to clear animations when i press fire key


Re: OnPlayerKeyStateChange - [..MonTaNa..] - 27.02.2014

Try this,
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(sit[playerid] == 1)
    {
        ClearAnimations(playerid);
        sit[playerid] = 0;
    }



Re: OnPlayerKeyStateChange - alishvasis - 27.02.2014

Use This :
Код:
if(newkeys == KEY_FIRE)
{
	   if(sit[playerid] == 1)
	   {
	   sit[playerid] =0;
	   ApplyAnimation(playerid,"FIGHT_C","FightC_M",5,0,0,0,0,0);
	   }
if(oldkeys == KEY_FIRE)
{
	   if(sit[playerid] == 0)
	   {
           sit[playerid] =1;
	   ClearAnimations(playerid);
	   }
}



Re: OnPlayerKeyStateChange - AroseKhanNiazi - 27.02.2014

Still same warning tried both


Re: OnPlayerKeyStateChange - alishvasis - 27.02.2014

Quote:
Originally Posted by AroseKhanNaizi
Посмотреть сообщение
Still same warning tried both
Are You Use Key Fire For Other ? or Just Use Key_fire For This?


Respuesta: OnPlayerKeyStateChange - CuervO - 27.02.2014

Код:
if(newkeys & KEY_FIRE)
	{
	    if(sit[playerid])
	    {
	        sit[playerid] = 0;
	        ClearAnimations(playerid);
	    }
	}
There's definitely no way you can get missing arguments unless you're not using an updated version of the includes.


Re: Respuesta: OnPlayerKeyStateChange - alishvasis - 27.02.2014

Use This Its Working
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_FIRE)
{
if(sit[playerid] == 1)
{
sit[playerid] =0;
ApplyAnimation(playerid,"FIGHT_C","FightC_M",5,0,0,0,0,0);
}
}
if(oldkeys == KEY_FIRE)
{
if(sit[playerid] == 0)
{
sit[playerid] =1;
ClearAnimations(playerid);
}
}
return 1;
}



Re: OnPlayerKeyStateChange - AroseKhanNiazi - 27.02.2014

same warning