#1

How to make if an animations is alredy on it can't do other anim ... (Speaking for the server Not a command anim.)
Reply
#2

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
You can use GetPlayerAnimationIndex(playerid)

OR (which i recommend)

Setting a variable when a player is doing an anim, then check it before doing another one.
how can i set varible (i'm a begginer )
Reply
#3

Quote:
Originally Posted by JakeHunter1
Посмотреть сообщение
how can i set varible (i'm a begginer )
Here's an example -

pawn Код:
new isplayerusinganim[MAX_PLAYERS]; // place it on the top of your script

public OnPlayerConnect(playerid)
{
    isplayerusinganim[playerid] = 0; // it means that  the player isn't using any animation
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    isplayerusinganim[playerid] = 0;
    return 1;
}
   

CMD:dance(playerid,params[]) // just an example
{
   if(isplayerusinganim[playerid] == 0)
   {
           ApplyAnimation(playerid,"DANCING","dance_loop",4.1,1,1,1,1,1,1);
           isplayerusinganim[playerid] = 1;
   }
   else if(isplayerusinganim[playerid] == 1)
   {
        SendClientMessage(playerid, 0xFFFFFFc8, "{FF0000}Error: {FFFFFF}An Animation is already in progress, use /stopanim to stop the current anim.);
   }
   return 1;
}

CMD:stopanim(playerid,params[])
{
    ClearAnimations(playerid);
    isplayerusinganim[playerid] = 0;
    return 1;
}
Reply
#4

Quote:
Originally Posted by Adityz
Посмотреть сообщение
Here's an example -

pawn Код:
new isplayerusinganim[MAX_PLAYERS]; // place it on the top of your script

public OnPlayerConnect(playerid)
{
    isplayerusinganim[playerid] = 0; // it means that  the player isn't using any animation
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    isplayerusinganim[playerid] = 0;
    return 1;
}
   

CMD:dance(playerid,params[]) // just an example
{
   if(isplayerusinganim[playerid] == 0)
   {
           ApplyAnimation(playerid,"DANCING","dance_loop",4.1,1,1,1,1,1,1);
           isplayerusinganim[playerid] = 1;
   }
   else if(isplayerusinganim[playerid] == 1)
   {
        SendClientMessage(playerid, 0xFFFFFFc8, "{FF0000}Error: {FFFFFF}An Animation is already in progress, use /stopanim to stop the current anim.);
   }
   return 1;
}

CMD:stopanim(playerid,params[])
{
    ClearAnimations(playerid);
    isplayerusinganim[playerid] = 0;
    return 1;
}
Thanks it works .. +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)