Advertisement
Guest User

SA-MP Simple Tazer v0.2

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