Example:
PHP код:
#include a_samp
#include zcmd
new gPlayerUsingLoopingAnim[MAX_PLAYERS];
new Text:txtAnimHelper;
CMD:wank(playerid, params[])
{
new player1;
if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
else player1 = strval(params);
if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /wank [playerid]");
PlayAnimEx(player1, "PAULNMAC", "wank_loop", 4.0, 1, 0, 0, 0, 0, 1);
return 1;
}
PlayAnimEx(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync)
{
gPlayerUsingLoopingAnim[playerid] = 1;
ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
TextDrawShowForPlayer(playerid,txtAnimHelper);
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock ReturnPlayerID(PlayerName[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(strfind(pName(i),PlayerName,true)!=-1) return i;
}
}
return INVALID_PLAYER_ID;
}
stock pName(playerid)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
return plname;
}
if you mean /playanimation animationid
PHP код:
#include a_samp
#include zcmd
CMD:playanimation(playerid, params[])
{
new animation = strval(params);
if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /playanimation [animationid]");
SetPlayerSpecialAction(playerid, animation);
return 1;
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock ReturnPlayerID(PlayerName[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(strfind(pName(i),PlayerName,true)!=-1) return i;
}
}
return INVALID_PLAYER_ID;
}
stock pName(playerid)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
return plname;
}
if you wana play animation for other player:
PHP код:
#include a_samp
#include zcmd
CMD:playpanimation(playerid, params[])
{
new player1;
if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
else player1 = strval(params);
new animation = strval(params);
if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /playpanimation [playerid] [animationid]");
SetPlayerSpecialAction(player1, animation);
return 1;
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock ReturnPlayerID(PlayerName[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(strfind(pName(i),PlayerName,true)!=-1) return i;
}
}
return INVALID_PLAYER_ID;
}
stock pName(playerid)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
return plname;
}