Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:backup(playerid, params[])
- {
- new
- string[128];
- if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1)
- {
- if(CallingBackUp[playerid] == 1)
- {
- SendClientMessage(playerid, COLOR_GREY, "You are already calling backup. Try /cancelbackup.");
- return 1;
- }
- if(playerVariables[playerid][pCopDuty] == 0) {
- return SendClientMessage(playerid, COLOR_GREY, "You are not on duty!");
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(groupVariables[playerVariables[i][pGroup]][gGroupType] == 1 && playerVariables[i][pCopDuty] == 1) {
- if(CallingBackUp[i] > 0) {
- KillTimer(CPTimer[playerid]);
- }
- CallingBackUp[i] = 0;
- format(string, sizeof(string), "SAPD HQ: %s %s is requesting backup at his location. Respond code 3.", GetRankName(playerid), GetName(playerid));
- SendClientMessage(i, COLOR_RADIOCHAT, string);
- CPTimer[playerid] = SetTimerEx("UpdateCP", 1000, true, "i", playerid);
- CallingBackUp[playerid] = 1;
- }
- }
- }
- return 1;
- }
- CMD:cancelbackup(playerid, params[]) //this works!
- {
- if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1)
- {
- if(CallingBackUp[playerid] == 1)
- {
- CallingBackUp[playerid] = 0;
- KillTimer(CPTimer[playerid]);
- }
- else SendClientMessage(playerid, COLOR_GREY, "You are not calling for back up.");
- }
- return 1;
- }
- public UpdateCP(playerid)
- {
- new Float:pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- for(new i=0; i < MAX_PLAYERS; i++) {
- if(groupVariables[playerVariables[i][pGroup]][gGroupType] == 1 && playerVariables[i][pCopDuty] == 1) {
- SetPlayerCheckpoint(i, pos[0], pos[1], pos[2], 3.0);
- }
- }
- }
Add Comment
Please, Sign In to add comment