Advertisement
Guest User

SA-MP Tazer

a guest
Aug 22nd, 2010
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.88 KB | None | 0 0
  1. #include <a_samp>
  2. #define COLOR_LIGHTBLUE 0x33CCFFAA
  3. #define COLOR_PURPLE 0x9E18E7FF
  4.  
  5. forward IsACop(playerid);
  6. forward tablauf(playerid);
  7. forward untazer(playerid);
  8. new tazered[MAX_PLAYERS];
  9. new tused[MAX_PLAYERS];
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     print("\n--------------------------------------");
  14.     print("     Tazer-System | (C) by Firerfan     ");
  15.     print("--------------------------------------\n");
  16. }
  17.  
  18. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  19. {
  20.     if(newkeys == KEY_FIRE)
  21.     {
  22.         if(GetPlayerWeapon(playerid)==13)
  23.         {
  24.             if(IsACop(playerid))
  25.             {
  26.                 if(tused[playerid]==0)
  27.                 {
  28.                     new Float:cx,Float:cy,Float:cz;
  29.                     GetPlayerPos(playerid,cx,cy,cz);
  30.                     for(new i = 0; i < MAX_PLAYERS; i++)
  31.                     {
  32.                         if(IsPlayerConnected(i))
  33.                         {
  34.                             if(playerid != i)
  35.                             {
  36.                                 if(!IsACop(i))
  37.                                 {
  38.                                     if(PlayerToPoint(2.0,i,cx,cy,cz))
  39.                                     {
  40.                                         if(tazered[i]==0)
  41.                                         {
  42.                                             new trand = random(20);
  43.                                             if(trand==10)
  44.                                             {
  45.                                                 new name[MAX_PLAYER_NAME],cname[MAX_PLAYER_NAME],string[286];
  46.                                                 GetPlayerName(i,name,sizeof(name));
  47.                                                 GetPlayerName(playerid,cname,sizeof(cname));
  48.                                                 format(string, sizeof(string), "%s hat %s bei einem Tazerversucht getötet",cname,name);
  49.                                                 printf(string);
  50.                                                 format(string, sizeof(string), "** %s Tazert %s **",cname,name);
  51.                                                 ProxDetector(15.0,i,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  52.                                                 SetPlayerHealth(i,0);
  53.                                                 tused[playerid]=1;
  54.                                                 SetTimerEx("tablauf",30000,0,"i",playerid);
  55.                                                 format(string, sizeof(string), "** Du hast %s bei einem Tazerversuch getötet!",name);
  56.                                                 SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
  57.                                                 format(string, sizeof(string), "** %s hat dich bei einem Tazerversuch getötet!",cname);
  58.                                                 SendClientMessage(i,COLOR_LIGHTBLUE,string);
  59.                                             }
  60.                                             else
  61.                                             {
  62.                                                 new name[MAX_PLAYER_NAME],cname[MAX_PLAYER_NAME],string[286];
  63.                                                 GetPlayerName(i,name,sizeof(name));
  64.                                                 GetPlayerName(playerid,cname,sizeof(cname));
  65.                                                 format(string, sizeof(string), "%s hat erfolgreich %s getazert",cname,name);
  66.                                                 printf(string);
  67.                                                 format(string, sizeof(string), "** %s Tazert %s **",cname,name);
  68.                                                 ProxDetector(15.0,i,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  69.                                                 tazered[i]=1;
  70.                                                 tused[playerid]=1;
  71.                                                 TogglePlayerControllable(playerid,0);
  72.                                                 SetTimerEx("untazer",10000,0,"i",i);
  73.                                                 SetTimerEx("tablauf",30000,0,"i",playerid);
  74.                                                 GameTextForPlayer(i,"~b~Getazert!",5000,3);
  75.                                             }
  76.                                         }
  77.                                     }
  78.                                 }
  79.                             }
  80.                         }
  81.                     }
  82.                 }
  83.             }
  84.         }
  85.     }
  86. }
  87. public IsACop(playerid)
  88. {
  89.     new skin = GetPlayerSkin(playerid);
  90.     if(skin == 280 || skin == 281 || skin == 282 || skin == 283 || 284 || 285)
  91.     {
  92.         return 1;
  93.     }
  94.     return 0;
  95. }
  96.  
  97. public untazer(playerid)
  98. {
  99.     TogglePlayerControllable(playerid,1);
  100.     tazered[playerid]=0;
  101.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"** Du kannst dich langsam wieder bewegen...");
  102. }
  103.  
  104. public tablauf(playerid)
  105. {
  106.     tused[playerid]=0;
  107.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"** Du kannst deinen Tazer nun wieder benutzen!");
  108. }
  109.  
  110. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  111. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  112. {
  113.     if(IsPlayerConnected(playerid))
  114.     {
  115.         new Float:oldposx, Float:oldposy, Float:oldposz;
  116.         new Float:tempposx, Float:tempposy, Float:tempposz;
  117.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  118.         tempposx = (oldposx -x);
  119.         tempposy = (oldposy -y);
  120.         tempposz = (oldposz -z);
  121.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  122.         {
  123.             return 1;
  124.         }
  125.     }
  126.     return 0;
  127. }
  128.  
  129. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  130. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  131. {
  132.     if(IsPlayerConnected(playerid))
  133.     {
  134.         new Float:posx, Float:posy, Float:posz;
  135.         new Float:oldposx, Float:oldposy, Float:oldposz;
  136.         new Float:tempposx, Float:tempposy, Float:tempposz;
  137.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  138.         //radi = 2.0; //Trigger Radius
  139.         for(new i = 0; i < MAX_PLAYERS; i++)
  140.         {
  141.             if(IsPlayerConnected(i))
  142.             {
  143.                 GetPlayerPos(i, posx, posy, posz);
  144.                 tempposx = (oldposx -posx);
  145.                 tempposy = (oldposy -posy);
  146.                 tempposz = (oldposz -posz);
  147.                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  148.                 {
  149.                     SendClientMessage(i, col1, string);
  150.                 }
  151.                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  152.                 {
  153.                     SendClientMessage(i, col2, string);
  154.                 }
  155.                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  156.                 {
  157.                     SendClientMessage(i, col3, string);
  158.                 }
  159.                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  160.                 {
  161.                     SendClientMessage(i, col4, string);
  162.                 }
  163.                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  164.                 {
  165.                     SendClientMessage(i, col5, string);
  166.                 }
  167.             }
  168.         }
  169.     }//not connected
  170.     return 1;
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement