Advertisement
Guest User

Actors system

a guest
Jan 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.77 KB | None | 0 0
  1. CMD:spawnactor(playerid, params[])
  2. {
  3.     new Float:Pos[3],skinid,str[256],bool:invulnerability,Float:Angle;
  4.     if(sscanf(params,"il",skinid,invulnerability)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /spawnactor [skinid] [Vulnerability (0: invulnerable / 1: vulnerable)]");
  5.     GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
  6.     GetPlayerFacingAngle(playerid, Angle);
  7.     new Actor = CreateActor(skinid, Pos[0], Pos[1], Pos[2], 0);
  8.     SetPlayerPos(playerid,Pos[0]+1,Pos[1]+1,Pos[2]);
  9.     SetActorFacingAngle(Actor, Angle);
  10.     format(str,sizeof(str),"Actor %d was created! Pos: x[%f], y[%f], z[%f]",Actor,Pos[0],Pos[1],Pos[2]);
  11.     SendClientMessage(playerid,COLOR_GREEN,str);
  12.     if(invulnerability == false)
  13.     {
  14.         SetActorInvulnerable(Actor, true);
  15.         SendClientMessage(playerid,COLOR_GREEN,"This actor is invulnerable!");
  16.     }
  17.     else if(invulnerability == true)
  18.     {
  19.         SetActorInvulnerable(Actor,false);
  20.         SendClientMessage(playerid,COLOR_GREEN,"This actor is vulnerable!");
  21.     }
  22.     return 1;
  23. }
  24.  
  25. CMD:removeactor(playerid, params[])
  26. {
  27.     new actorid,str[256];
  28.     if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /removeactor [actor id]");
  29.     format(str,sizeof(str),"Actor %d was removed!",actorid);
  30.     if(IsValidActor(actorid))
  31.     {
  32.         SendClientMessage(playerid,COLOR_GREEN,str);
  33.         DestroyActor(actorid);
  34.     }
  35.     return 1;
  36. }
  37.  
  38. CMD:clearallactors(playerid, params[])
  39. {
  40.     for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
  41.     {
  42.         if(IsValidActor(i))
  43.         {
  44.             DestroyActor(i);
  45.         }
  46.     }
  47.     return 1;
  48. }
  49.  
  50. CMD:gotoactor(playerid, params[])
  51. {
  52.     new Float:Pos[3],actorid,str[256];
  53.     if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /gotoactor [actor id]");
  54.     GetActorPos(actorid,Pos[0],Pos[1],Pos[2]);
  55.     SetPlayerPos(playerid,Pos[0]+3,Pos[1],Pos[2]+8);
  56.     format(str,sizeof(str),"You have been teleported to actor %d!",actorid);
  57.     SendClientMessage(playerid,COLOR_GREEN,str);
  58.     return 1;
  59. }
  60.  
  61. CMD:allactors(playerid, params[])
  62. {
  63.     new str[400];
  64.     for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
  65.     {
  66.         if(IsValidActor(i))
  67.         {
  68.             format(str,sizeof(str),"Actor: %d | vulnerability: %d",i,!IsActorInvulnerable(i));
  69.             SendClientMessage(playerid,COLOR_GREEN,str);
  70.         }
  71.     }
  72.     return 1;
  73. }
  74.  
  75. CMD:setactoranim(playerid, params[])
  76. {
  77.     new animation[256],actorid,str[256];
  78.     if(sscanf(params,"is[100]",actorid,animation)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /setactoranim [actor id] [animation]");
  79.     if(IsValidActor(actorid))
  80.     {
  81.         if(strcmp(animation, "injured") == 0)
  82.         {
  83.             ApplyActorAnimation(actorid, "SWEET", "Sweet_injuredloop", 4.1, 1, 0, 0, 0, 0);
  84.             ApplyActorAnimation(actorid, "SWEET", "Sweet_injuredloop", 4.1, 1, 0, 0, 0, 0);
  85.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  86.             SendClientMessage(playerid,COLOR_GREEN,str);
  87.         }
  88.         if(strcmp(animation, "handsup") == 0)
  89.         {
  90.             ApplyActorAnimation(actorid, "SHOP", "SHP_Rob_HandsUp", 4.1, 1, 0, 0, 0, 0);
  91.             ApplyActorAnimation(actorid, "SHOP", "SHP_Rob_HandsUp", 4.1, 1, 0, 0, 0, 0);
  92.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  93.             SendClientMessage(playerid,COLOR_GREEN,str);
  94.         }
  95.         if(strcmp(animation, "aim") == 0)
  96.         {
  97.             ApplyActorAnimation(actorid, "SHOP", "SHP_Gun_Aim", 4.1, 1, 0, 0, 0, 0);
  98.             ApplyActorAnimation(actorid, "SHOP", "SHP_Gun_Aim", 4.1, 1, 0, 0, 0, 0);
  99.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  100.             SendClientMessage(playerid,COLOR_GREEN,str);
  101.         }
  102.         if(strcmp(animation, "sit") == 0)
  103.         {
  104.             ApplyActorAnimation(actorid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0);
  105.             ApplyActorAnimation(actorid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0);
  106.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  107.             SendClientMessage(playerid,COLOR_GREEN,str);
  108.         }
  109.         if(strcmp(animation, "lean") == 0)
  110.         {
  111.             ApplyActorAnimation(actorid, "GANGS", "leanIDLE", 4.1, 1, 0, 0, 0, 0);
  112.             ApplyActorAnimation(actorid, "GANGS", "leanIDLE", 4.1, 1, 0, 0, 0, 0);
  113.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  114.             SendClientMessage(playerid,COLOR_GREEN,str);
  115.         }
  116.     }
  117.     else return SendClientMessage(playerid,COLOR_RED,"Invalid actor id!");
  118.     return 1;
  119. }
  120.  
  121. CMD:cancelactoranim(playerid, params[])
  122. {
  123.     new actorid;
  124.     if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /cancelactoranim [actor id]");
  125.     if(IsValidActor(actorid))
  126.     {
  127.         ClearActorAnimations(actorid);
  128.         SendClientMessage(playerid,COLOR_GREEN,"Animation canceled!");
  129.     }
  130.     else return SendClientMessage(playerid,COLOR_RED,"Invalid actor id!");
  131.     return 1;
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement