Guest User

Untitled

a guest
May 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. CMD:backup(playerid, params[])
  2. {
  3.     new
  4.         string[128];
  5.     if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1)
  6.     {
  7.         if(CallingBackUp[playerid] == 1)
  8.         {
  9.             SendClientMessage(playerid, COLOR_GREY, "You are already calling backup. Try /cancelbackup.");
  10.             return 1;
  11.         }
  12.         if(playerVariables[playerid][pCopDuty] == 0) {
  13.             return SendClientMessage(playerid, COLOR_GREY, "You are not on duty!");
  14.         }
  15.         for(new i = 0; i < MAX_PLAYERS; i++)
  16.         {
  17.             if(groupVariables[playerVariables[i][pGroup]][gGroupType] == 1 && playerVariables[i][pCopDuty] == 1) {
  18.                 if(CallingBackUp[i] > 0) {
  19.                     KillTimer(CPTimer[playerid]);
  20.                 }
  21.                 CallingBackUp[i] = 0;
  22.                 format(string, sizeof(string), "SAPD HQ: %s %s is requesting backup at his location. Respond code 3.", GetRankName(playerid), GetName(playerid));
  23.                 SendClientMessage(i, COLOR_RADIOCHAT, string);
  24.                 CPTimer[playerid] = SetTimerEx("UpdateCP", 1000, true, "i", playerid);
  25.                 CallingBackUp[playerid] = 1;
  26.             }
  27.         }
  28.     }
  29.     return 1;
  30. }
  31.  
  32. CMD:cancelbackup(playerid, params[]) //this works!
  33. {
  34.     if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1)
  35.     {
  36.         if(CallingBackUp[playerid] == 1)
  37.         {
  38.             CallingBackUp[playerid] = 0;
  39.             KillTimer(CPTimer[playerid]);
  40.         }
  41.         else SendClientMessage(playerid, COLOR_GREY, "You are not calling for back up.");
  42.     }
  43.     return 1;
  44. }
  45.  
  46. public UpdateCP(playerid)
  47. {
  48.     new Float:pos[3];
  49.     GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  50.     for(new i=0; i < MAX_PLAYERS; i++) {
  51.         if(groupVariables[playerVariables[i][pGroup]][gGroupType] == 1 && playerVariables[i][pCopDuty] == 1) {
  52.             SetPlayerCheckpoint(i, pos[0], pos[1], pos[2], 3.0);
  53.         }
  54.     }
  55. }
Add Comment
Please, Sign In to add comment