24.05.2014, 18:15
How to make if an animations is alredy on it can't do other anim ... (Speaking for the server Not a command anim.)
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;
}
Here's an example -
pawn Код:
|