ApplyAnim after player landing
#1

i have a problem with my code..

i would like the player do a animation after jumping and landing..

My Code work for the first time, but if i jump again or again, it bugs a little

Code:
Код:
new bhopAnim[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
	bhopAnim[playerid] = 0;
	return 1;
}
public OnPlayerUpdate(playerid)
{
     if(bhopAnim[playerid] == 1)
     {
          if(GetPlayerAnimationIndex(playerid))
          {
               new animlib[32], animname[32];
               GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
               if(!strcmp(animname, "JUMP_LAND", true))
               {
     				ApplyAnimation(playerid, "PED","FALL_LAND", 4.1, 0,1,1,0,0);
                    SendClientMessage(playerid, 0xFFFFFFFF, "MakeAnimation");
                    SendClientMessage(playerid, 0xFFFFFFFF, "");
                    bhopAnim[playerid] = 0;
               }
          }
     }
     return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if((newkeys & KEY_JUMP) && !IsPlayerInAnyVehicle(playerid))
     {
          SendClientMessage(playerid, 0xFFFFFFFF, "if JUMP && !Car");
          SendClientMessage(playerid, 0xFFFFFFFF, "");
          if((oldkeys & KEY_UP) || (oldkeys & KEY_DOWN) || (oldkeys & KEY_LEFT) || (oldkeys & KEY_RIGHT) || (oldkeys & KEY_SPRINT))
          {
               SendClientMessage(playerid, 0xFFFFFFFF, "if (W || A || S || D || SHIFT)");
               SendClientMessage(playerid, 0xFFFFFFFF, "");
               bhopAnim[playerid] = 1;
          }
     }
     return 1;
}
thanks for your help
Reply
#2

How does it bug ?
Reply
#3

My Code work for the first time, but if i jump again or again, it bugs a little

the first jump, animation = after landing = OK
second jump, animation = before landing = buggy :/
Reply
#4

Okay. But what exactly means buggy ?
Reply
#5

it means, he make the animation before he landing ^^ and thats really gay :3
Reply
#6

Well, I would never do it in "OnPlayerUpdate"... That's a sh*t, because it's "started" whenever you do something, am I right ?

"This callback is called, on average, 30 times per second, per player; only use it when you know what it's meant for (or more importantly what it's NOT meant for). " (wiki)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)