JhnzRep

Police GM Addon

Feb 22nd, 2012
3,007
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.77 KB | None | 0 0
  1. /*==============================================================================
  2. -------------------------------------Cuff--------------------------------------
  3. ==============================================================================*/
  4.  
  5. cmd(cuff, playerid, params[])
  6. {
  7.  
  8.     new ID, string[20+MAX_PLAYER_NAME];
  9.     if(sscanf(params, "u", ID)) return SendClientMessage(playerid, GREY, "CMD:/cuff [playerid]");
  10.     if(pTazed[ID] == 0) return SendClientMessage(playerid, GREY, "You will have to taze this player before cuffing him");
  11.     if(ID == playerid) return SendClientMessage(playerid, GREY, "You cannot cuff/uncuff your self");
  12.     if(pCuffed[ID] == 0)
  13.     {
  14.         pCuffed[ID] = 1;
  15.         format(string, sizeof(string), "%s has been cuffed by %s.", RemoveUnderScore(ID),RemoveUnderScore(playerid));
  16.         cufftimer[ID] = SetTimerEx("UnCuff", 500000, 0, "d", ID);
  17.         ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  18.         TogglePlayerControllable(ID, false);
  19.         ClearAnimations(ID);
  20.         KillTimer(tazetimer[ID]);
  21.         pTazed[ID] = 0;
  22.     }
  23.     else
  24.     {
  25.         pCuffed[ID] = 0;
  26.         KillTimer(cufftimer[ID]);
  27.         format(string, sizeof(string), "%s has been uncuffed by %s.", RemoveUnderScore(ID), RemoveUnderScore(playerid));
  28.         ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  29.         TogglePlayerControllable(ID, true);
  30.     }
  31.     return 1;
  32. }
  33.  
  34. forward UnCuff(playerid);
  35. public UnCuff(playerid)
  36. {
  37.     pCuffed[playerid] = 0;
  38.     TogglePlayerControllable(playerid, true);
  39.     SendClientMessage(playerid, PURPLE, "Your cuffs broke, run!");
  40.     Dragged[playerid] = 0;
  41.     KillTimer(draggedtimer[playerid]);
  42. }
  43.  
  44. /*==============================================================================
  45. --------------------------------------Drag--------------------------------------
  46. ==============================================================================*/
  47.  
  48. cmd(drag, playerid, params[])
  49. {
  50.     new ID, string[26+MAX_PLAYER_NAME], string2[20+MAX_PLAYER_NAME];
  51.     if(sscanf(params, "u", ID)) return SendClientMessage(playerid, GREY, "CMD:/cuff [playerid]");
  52.     if(pCuffed[ID] == 0) return SendClientMessage(playerid, GREY, "This player must first be cuffed");
  53.     if(Dragged[ID] == 0 && Dragging[playerid] == 0)
  54.     {
  55.         Dragged[ID] = 1;
  56.         Dragging[playerid] = 1;
  57.         format(string, sizeof(string), "You are being dragged by %s.", RemoveUnderScore(playerid));
  58.         format(string2, sizeof(string2), " You are dragging %s.", RemoveUnderScore(ID));
  59.         SCM(playerid, PURPLE, string2);
  60.         SCM(ID, PURPLE, string);
  61.         draggedtimer[ID] = SetTimerEx("Draggingt", 1000, 1, "dd", playerid,ID);
  62.     }
  63.     else
  64.     {
  65.         Dragged[ID] = 0;
  66.         Dragging[playerid] = 0;
  67.         SCM(playerid, PURPLE, "You have stopped dragging your target.");
  68.         SCM(ID, PURPLE, "You aren't being dragged anymore.");
  69.         KillTimer(draggedtimer[ID]);
  70.     }
  71.     return 1;
  72. }
  73.  
  74. forward Draggingt(playerid, ID);
  75. public Draggingt(playerid, ID)
  76. {
  77.     new Float:dX, Float:dY, Float:dZ;
  78.     GetPlayerPos(playerid, dX, dY, dZ);
  79.     SetPlayerPos(ID, dX+1, dY, dZ);
  80. }
  81.  
  82.  
  83.  
  84. /*==============================================================================
  85. --------------------------------RemoveUnderScore--------------------------------
  86. ==============================================================================*/
  87. stock RemoveUnderScore(playerid)
  88. {
  89.     new name[MAX_PLAYER_NAME];
  90.     GetPlayerName(playerid,name,sizeof(name));
  91.     for(new i = 0; i < MAX_PLAYER_NAME; i++)
  92.     {
  93.         if(name[i] == '_') name[i] = ' ';
  94.     }
  95.     return name;
  96. }
  97.  
  98. //==============================================================================
  99. //---------------------------------PROXDETECTOR---------------------------------
  100. //==============================================================================
  101. stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  102. {
  103.     if(IsPlayerConnected(playerid))
  104.     {
  105.         new Float:posx, Float:posy, Float:posz;
  106.         new Float:oldposx, Float:oldposy, Float:oldposz;
  107.         new Float:tempposx, Float:tempposy, Float:tempposz;
  108.         new invehicle[MAX_PLAYERS];
  109.         new virtualworld = GetPlayerVirtualWorld(playerid);
  110.         new interior = GetPlayerInterior(playerid);
  111.         new vehicleid = GetPlayerVehicleID(playerid);
  112.         new ivehicleid;
  113.         if(vehicleid)
  114.         {
  115.             GetVehiclePos(vehicleid,oldposx,oldposy,oldposz);
  116.         }
  117.         else
  118.         {
  119.             GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  120.             vehicleid = GetPlayerVehicleID(playerid);
  121.         }
  122.         for(new i = 0; i < MAX_PLAYERS; i++)
  123.         {
  124.             if(IsPlayerConnected(i))
  125.             {
  126.                 if(!BigEar[i])
  127.                 {
  128.                     if(GetPlayerVirtualWorld(i) == virtualworld)
  129.                     {
  130.                         if((GetPlayerInterior(i) == interior))
  131.                         {
  132.                             if(vehicleid)
  133.                             {
  134.                                 if(IsPlayerInVehicle(i,vehicleid)) invehicle[i] = 1;
  135.                             }
  136.                             if(!invehicle[i])
  137.                             {
  138.                                 if(IsPlayerInAnyVehicle(i))
  139.                                 {
  140.                                     ivehicleid = GetPlayerVehicleID(i);
  141.                                     GetVehiclePos(ivehicleid,posx,posy,posz);
  142.                                 }
  143.                                 else
  144.                                 {
  145.                                     GetPlayerPos(i,posx,posy,posz);
  146.                                 }
  147.                                 tempposx = (oldposx -posx);
  148.                                 tempposy = (oldposy -posy);
  149.                                 tempposz = (oldposz -posz);
  150.                                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) SendClientMessage(i, col1, string);
  151.                                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SendClientMessage(i, col2, string);
  152.                                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SendClientMessage(i, col3, string);
  153.                                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SendClientMessage(i, col4, string);
  154.                                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SendClientMessage(i, col5, string);
  155.                             }
  156.                             else SendClientMessage(i, col1, string);
  157.                         }
  158.                     }
  159.                 }
  160.                 else SendClientMessage(i, col1, string);
  161.             }
  162.         }
  163.     }
  164.     return 1;
  165. }
  166.  
  167. /*==============================================================================
  168. -------------------------------------Tazer--------------------------------------
  169. ==============================================================================*/
  170.  
  171. cmd(tazer, playerid, params[])
  172. {
  173.     new string[28+MAX_PLAYER_NAME];
  174.     if(Tazer[playerid] == 0)
  175.     {
  176.         GivePlayerWeapon(playerid, 23, 9999);
  177.         format(string, sizeof(string),"%s has unholstered his tazer.", RemoveUnderScore(playerid));
  178.         ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  179.         Tazer[playerid] = 1;
  180.     }
  181.     else
  182.     {
  183.         SetPlayerAmmo(playerid, 23, 0);
  184.         format(string, sizeof(string),"%s has holstered his tazer.", RemoveUnderScore(playerid));
  185.         Tazer[playerid] = 0;
  186.         ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  187.     }
  188.     return 1;
  189. }
  190.  
  191. forward Tazed(playerid);
  192. public Tazed(playerid)
  193. {
  194.       pTazed[playerid] = 0;
  195.       TogglePlayerControllable(playerid, true);
  196.       ClearAnimations(playerid);
  197.       return 1;
  198. }
  199.  
  200. public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
  201. {
  202.     if(GetPlayerWeapon(Shooter) == 23)
  203.     {
  204.         new string[17+48], playerid;
  205.         TogglePlayerControllable(Target, false);
  206.         ApplyAnimation(Target,"CRACK","crckdeth2",4.1,1,1,1,1,1);
  207.         pTazed[Target] = 1;
  208.         tazetimer[Target] = SetTimerEx("Tazed", 10000, 0, "d", Target);
  209.         format(string, sizeof(string), "%s has been tazed by %s.", RemoveUnderScore(Target), RemoveUnderScore(Shooter));
  210.         ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  211.     }
  212.     return 1;
  213. }
Advertisement
Add Comment
Please, Sign In to add comment