Animations by ID
#1

Hi,
Is there a way to play an animation by using the ID? I can't find working systems for my problem.

Thanks in advance!
Reply
#2

Example:
PHP код:
#include a_samp
#include zcmd
new gPlayerUsingLoopingAnim[MAX_PLAYERS];
new 
Text:txtAnimHelper;
CMD:wank(playeridparams[])
{
    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.0100001);
    return 
1;
}
PlayAnimEx(playeridanimlib[], animname[], Float:fDeltalooplockxlockyfreezetimeforcesync)
{
    
gPlayerUsingLoopingAnim[playerid] = 1;
    
ApplyAnimation(playeridanimlibanimnamefDeltalooplockxlockyfreezetimeforcesync);
    
TextDrawShowForPlayer(playerid,txtAnimHelper);
}
stock IsNumeric(string[])
{
    for (new 
0strlen(string); ji++)
    {
        if (
string[i] > '9' || string[i] < '0') return 0;
    }
    return 
1;
}
stock ReturnPlayerID(PlayerName[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        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(playeridplnamesizeof(plname));
  return 
plname;

if you mean /playanimation animationid
PHP код:
#include a_samp
#include zcmd
CMD:playanimation(playeridparams[])
{
    new 
animation strval(params);
    if(
isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /playanimation [animationid]");
       
SetPlayerSpecialAction(playeridanimation);
    return 
1;
}
stock IsNumeric(string[])
{
    for (new 
0strlen(string); ji++)
    {
        if (
string[i] > '9' || string[i] < '0') return 0;
    }
    return 
1;
}
stock ReturnPlayerID(PlayerName[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        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(playeridplnamesizeof(plname));
  return 
plname;

if you wana play animation for other player:
PHP код:
#include a_samp
#include zcmd
CMD:playpanimation(playeridparams[])
{
    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(player1animation);
    return 
1;
}
stock IsNumeric(string[])
{
    for (new 
0strlen(string); ji++)
    {
        if (
string[i] > '9' || string[i] < '0') return 0;
    }
    return 
1;
}
stock ReturnPlayerID(PlayerName[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        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(playeridplnamesizeof(plname));
  return 
plname;

Reply
#3

Try:

PHP код:
CMD:Animation(playeridparams[]) {
    new 
animlib[32], animname[32],loop;
    if(
sscanf(params"s[32]s[32]i"animlibanimnameloop)) return SendClientMessage(playerid, -1"{FF0000}Use: /anim [animlib] [animname] [loop (0-1)");
    
SetPlayerSpecialAction(playerid, (animlibanimname4.1loop1100)); printf"(running Animation %d",animname);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)