Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.12 KB | None | 0 0
  1. #include <a_actor>
  2. ///////////
  3. native GetActorPoolSize();
  4.  
  5. forward OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart);
  6.  
  7. native GetPlayerTargetActor(playerid);
  8.  
  9. //Just keep "forward OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart);" and "native GetPlayerTargetActor(playerid);" perhaps they will be needed in the future :P
  10.  
  11. //this system was made by pizza, i added 3d text identifying the id of the actor to make it easy :D
  12. //commands are:
  13. // /spawnactor [skin id] [Vulnerability (0: invulnerable / 1: vulnerable)] > spawns the actor where the player is facing
  14. // /removeactor [actor id] (id can be viewed if went near him or /allactors) > removes specific actor
  15. // /clearallactors > clears all actors
  16. // /gotoactor [actor id] > TP you to the actor's POS (position)
  17. // /setactoranim [animation name] > Set an anim on actor (must be excuted twice due to preloading, if I added the stock it will slow the server CPU, even in a localhost server it slows my game)
  18. // /cancelactoranim [actor id] > cancels the anim that has been excuted on the actor
  19.  
  20. new Text3D:ActorLabel;
  21. CMD:spawnactor(playerid, params[])
  22. {
  23.     new Float:Pos[3],skinid,str[256],bool:invulnerability,Float:Angle,str2[256];
  24.     if(sscanf(params,"il",skinid,invulnerability)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /spawnactor [skinid] [Vulnerability (0: invulnerable / 1: vulnerable)]");
  25.     GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
  26.     GetPlayerFacingAngle(playerid, Angle);
  27.     new Actor = CreateActor(skinid, Pos[0], Pos[1], Pos[2], 0);
  28.     SetPlayerPos(playerid,Pos[0]+1,Pos[1]+1,Pos[2]);
  29.     SetActorFacingAngle(Actor, Angle);
  30.     format(str,sizeof(str),"Actor %d was created! Pos: x[%f], y[%f], z[%f]",Actor,Pos[0],Pos[1],Pos[2]);
  31.     SendClientMessage(playerid,COLOR_GREEN,str);
  32.     if(invulnerability == false)
  33.     {
  34.         SetActorInvulnerable(Actor, true);
  35.         SendClientMessage(playerid,COLOR_GREEN,"This actor is invulnerable!");
  36.     }
  37.     else if(invulnerability == true)
  38.     {
  39.         SetActorInvulnerable(Actor,false);
  40.         SendClientMessage(playerid,COLOR_GREEN,"This actor is vulnerable!");
  41.     }
  42.     format(str2,sizeof(str2),"Actor ID: %d",Actor);
  43.     ActorLabel = Create3DTextLabel(str2, COLOR_RED, Pos[0], Pos[1], Pos[2], 10, 0, 0);
  44.     return 1;
  45. }
  46.  
  47. CMD:removeactor(playerid, params[])
  48. {
  49.     new actorid,str[256];
  50.     if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /removeactor [actor id]");
  51.     format(str,sizeof(str),"Actor %d was removed!",actorid);
  52.     if(IsValidActor(actorid))
  53.     {
  54.         SendClientMessage(playerid,COLOR_GREEN,str);
  55.         DestroyActor(actorid);
  56.         Delete3DTextLabel(ActorLabel);
  57.     }
  58.     return 1;
  59. }
  60.  
  61. CMD:clearallactors(playerid, params[])
  62. {
  63.     for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
  64.     {
  65.         if(IsValidActor(i))
  66.         {
  67.             DestroyActor(i);
  68.             Delete3DTextLabel(ActorLabel);
  69.         }
  70.     }
  71.     return 1;
  72. }
  73.  
  74. CMD:gotoactor(playerid, params[])
  75. {
  76.     new Float:Pos[3],actorid,str[256];
  77.     if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /gotoactor [actor id]");
  78.     GetActorPos(actorid,Pos[0],Pos[1],Pos[2]);
  79.     SetPlayerPos(playerid,Pos[0]+3,Pos[1],Pos[2]+8);
  80.     format(str,sizeof(str),"You have been teleported to actor %d!",actorid);
  81.     SendClientMessage(playerid,COLOR_GREEN,str);
  82.     return 1;
  83. }
  84.  
  85. CMD:allactors(playerid, params[])
  86. {
  87.     new str[400];
  88.     for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
  89.     {
  90.         if(IsValidActor(i))
  91.         {
  92.             format(str,sizeof(str),"Actor: %d | vulnerability: %d",i,!IsActorInvulnerable(i));
  93.             SendClientMessage(playerid,COLOR_GREEN,str);
  94.         }
  95.     }
  96.     return 1;
  97. }
  98.  
  99. CMD:setactoranim(playerid, params[])
  100. {
  101.     new animation[256],actorid,str[256];
  102.     if(sscanf(params,"is[100]",actorid,animation)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /setactoranim [actor id] [animation]");
  103.     if(IsValidActor(actorid))
  104.     {
  105.         if(strcmp(animation, "injured") == 0)
  106.         {
  107.             ApplyActorAnimation(actorid, "SWEET", "Sweet_injuredloop", 4.1, 1, 0, 0, 0, 0);
  108.             ApplyActorAnimation(actorid, "SWEET", "Sweet_injuredloop", 4.1, 1, 0, 0, 0, 0);
  109.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  110.             SendClientMessage(playerid,COLOR_GREEN,str);
  111.         }
  112.         if(strcmp(animation, "handsup") == 0)
  113.         {
  114.             ApplyActorAnimation(actorid, "SHOP", "SHP_Rob_HandsUp", 4.1, 1, 0, 0, 0, 0);
  115.             ApplyActorAnimation(actorid, "SHOP", "SHP_Rob_HandsUp", 4.1, 1, 0, 0, 0, 0);
  116.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  117.             SendClientMessage(playerid,COLOR_GREEN,str);
  118.         }
  119.         if(strcmp(animation, "aim") == 0)
  120.         {
  121.             ApplyActorAnimation(actorid, "SHOP", "SHP_Gun_Aim", 4.1, 1, 0, 0, 0, 0);
  122.             ApplyActorAnimation(actorid, "SHOP", "SHP_Gun_Aim", 4.1, 1, 0, 0, 0, 0);
  123.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  124.             SendClientMessage(playerid,COLOR_GREEN,str);
  125.         }
  126.         if(strcmp(animation, "sit") == 0)
  127.         {
  128.             ApplyActorAnimation(actorid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0);
  129.             ApplyActorAnimation(actorid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0);
  130.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  131.             SendClientMessage(playerid,COLOR_GREEN,str);
  132.         }
  133.         if(strcmp(animation, "lean") == 0)
  134.         {
  135.             ApplyActorAnimation(actorid, "GANGS", "leanIDLE", 4.1, 1, 0, 0, 0, 0);
  136.             ApplyActorAnimation(actorid, "GANGS", "leanIDLE", 4.1, 1, 0, 0, 0, 0);
  137.             format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
  138.             SendClientMessage(playerid,COLOR_GREEN,str);
  139.         }
  140.     }
  141.     else return SendClientMessage(playerid,COLOR_RED,"Invalid actor id!");
  142.     return 1;
  143. }
  144.  
  145. CMD:cancelactoranim(playerid, params[])
  146. {
  147.     new actorid;
  148.     if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /cancelactoranim [actor id]");
  149.     if(IsValidActor(actorid))
  150.     {
  151.         ClearActorAnimations(actorid);
  152.         SendClientMessage(playerid,COLOR_GREEN,"Animation canceled!");
  153.     }
  154.     else return SendClientMessage(playerid,COLOR_RED,"Invalid actor id!");
  155.     return 1;
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement