Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_actor>
- ///////////
- native GetActorPoolSize();
- forward OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart);
- native GetPlayerTargetActor(playerid);
- //Just keep "forward OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart);" and "native GetPlayerTargetActor(playerid);" perhaps they will be needed in the future :P
- //this system was made by pizza, i added 3d text identifying the id of the actor to make it easy :D
- //commands are:
- // /spawnactor [skin id] [Vulnerability (0: invulnerable / 1: vulnerable)] > spawns the actor where the player is facing
- // /removeactor [actor id] (id can be viewed if went near him or /allactors) > removes specific actor
- // /clearallactors > clears all actors
- // /gotoactor [actor id] > TP you to the actor's POS (position)
- // /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)
- // /cancelactoranim [actor id] > cancels the anim that has been excuted on the actor
- new Text3D:ActorLabel;
- CMD:spawnactor(playerid, params[])
- {
- new Float:Pos[3],skinid,str[256],bool:invulnerability,Float:Angle,str2[256];
- if(sscanf(params,"il",skinid,invulnerability)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /spawnactor [skinid] [Vulnerability (0: invulnerable / 1: vulnerable)]");
- GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
- GetPlayerFacingAngle(playerid, Angle);
- new Actor = CreateActor(skinid, Pos[0], Pos[1], Pos[2], 0);
- SetPlayerPos(playerid,Pos[0]+1,Pos[1]+1,Pos[2]);
- SetActorFacingAngle(Actor, Angle);
- format(str,sizeof(str),"Actor %d was created! Pos: x[%f], y[%f], z[%f]",Actor,Pos[0],Pos[1],Pos[2]);
- SendClientMessage(playerid,COLOR_GREEN,str);
- if(invulnerability == false)
- {
- SetActorInvulnerable(Actor, true);
- SendClientMessage(playerid,COLOR_GREEN,"This actor is invulnerable!");
- }
- else if(invulnerability == true)
- {
- SetActorInvulnerable(Actor,false);
- SendClientMessage(playerid,COLOR_GREEN,"This actor is vulnerable!");
- }
- format(str2,sizeof(str2),"Actor ID: %d",Actor);
- ActorLabel = Create3DTextLabel(str2, COLOR_RED, Pos[0], Pos[1], Pos[2], 10, 0, 0);
- return 1;
- }
- CMD:removeactor(playerid, params[])
- {
- new actorid,str[256];
- if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /removeactor [actor id]");
- format(str,sizeof(str),"Actor %d was removed!",actorid);
- if(IsValidActor(actorid))
- {
- SendClientMessage(playerid,COLOR_GREEN,str);
- DestroyActor(actorid);
- Delete3DTextLabel(ActorLabel);
- }
- return 1;
- }
- CMD:clearallactors(playerid, params[])
- {
- for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
- {
- if(IsValidActor(i))
- {
- DestroyActor(i);
- Delete3DTextLabel(ActorLabel);
- }
- }
- return 1;
- }
- CMD:gotoactor(playerid, params[])
- {
- new Float:Pos[3],actorid,str[256];
- if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /gotoactor [actor id]");
- GetActorPos(actorid,Pos[0],Pos[1],Pos[2]);
- SetPlayerPos(playerid,Pos[0]+3,Pos[1],Pos[2]+8);
- format(str,sizeof(str),"You have been teleported to actor %d!",actorid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- return 1;
- }
- CMD:allactors(playerid, params[])
- {
- new str[400];
- for(new i = 0, j = GetActorPoolSize(); i <= j; i++)
- {
- if(IsValidActor(i))
- {
- format(str,sizeof(str),"Actor: %d | vulnerability: %d",i,!IsActorInvulnerable(i));
- SendClientMessage(playerid,COLOR_GREEN,str);
- }
- }
- return 1;
- }
- CMD:setactoranim(playerid, params[])
- {
- new animation[256],actorid,str[256];
- if(sscanf(params,"is[100]",actorid,animation)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /setactoranim [actor id] [animation]");
- if(IsValidActor(actorid))
- {
- if(strcmp(animation, "injured") == 0)
- {
- ApplyActorAnimation(actorid, "SWEET", "Sweet_injuredloop", 4.1, 1, 0, 0, 0, 0);
- ApplyActorAnimation(actorid, "SWEET", "Sweet_injuredloop", 4.1, 1, 0, 0, 0, 0);
- format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- }
- if(strcmp(animation, "handsup") == 0)
- {
- ApplyActorAnimation(actorid, "SHOP", "SHP_Rob_HandsUp", 4.1, 1, 0, 0, 0, 0);
- ApplyActorAnimation(actorid, "SHOP", "SHP_Rob_HandsUp", 4.1, 1, 0, 0, 0, 0);
- format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- }
- if(strcmp(animation, "aim") == 0)
- {
- ApplyActorAnimation(actorid, "SHOP", "SHP_Gun_Aim", 4.1, 1, 0, 0, 0, 0);
- ApplyActorAnimation(actorid, "SHOP", "SHP_Gun_Aim", 4.1, 1, 0, 0, 0, 0);
- format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- }
- if(strcmp(animation, "sit") == 0)
- {
- ApplyActorAnimation(actorid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0);
- ApplyActorAnimation(actorid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0);
- format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- }
- if(strcmp(animation, "lean") == 0)
- {
- ApplyActorAnimation(actorid, "GANGS", "leanIDLE", 4.1, 1, 0, 0, 0, 0);
- ApplyActorAnimation(actorid, "GANGS", "leanIDLE", 4.1, 1, 0, 0, 0, 0);
- format(str,sizeof(str),"Applied animation '%s' on Actor %d",animation,actorid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- }
- }
- else return SendClientMessage(playerid,COLOR_RED,"Invalid actor id!");
- return 1;
- }
- CMD:cancelactoranim(playerid, params[])
- {
- new actorid;
- if(sscanf(params,"i",actorid)) return SendClientMessage(playerid,COLOR_PURPLE,"USAGE: /cancelactoranim [actor id]");
- if(IsValidActor(actorid))
- {
- ClearActorAnimations(actorid);
- SendClientMessage(playerid,COLOR_GREEN,"Animation canceled!");
- }
- else return SendClientMessage(playerid,COLOR_RED,"Invalid actor id!");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement