• Страница 1 из 1
  • 1
Форум » Программирование в Pawno » Готовые команды » /gm - Проверка на гм
/gm - Проверка на гм
Добавлено 30.03.2016 в 23:40 | Сообщение №1
Сообщений: 265 Репутация: 0
Администраторы
Добавляем ко всем forward
Код
forward Gmtest(playerid);

Ко всем new
Код
new GmtestTimer[MAX_PLAYERS];  
new AdmGM[MAX_PLAYERS] = 0;  
new Float:AdmGMHP[MAX_PLAYERS];  
new AdmGMID[MAX_PLAYERS] = INVALID_PLAYER_ID;

В public OnPlayerCommandText
Код
if(strcmp(cmd, "/gm", true) == 0)   
      {   
          PlayerInfo [playerid][pAdmin]< 2) return SendClientMessage(playerid, COLOR_GRAD1, "Вам не доступна данная функция");   
          GetPlayerName(playerid, sendername, sizeof(sendername));   
          tmp = strtok(cmdtext, idx);   
          if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Введите: /gm [id]");   
          giveplayerid = strval(tmp);   
          GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));   
          GetPlayerName(playerid, sendername, sizeof(sendername));   
          if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "[Ошибка] Игрок не найден!");   
          new Float:boomx, Float:boomy, Float:boomz;   
          GetPlayerPos(giveplayerid,boomx, boomy, boomz);   
          GetPlayerHealth(giveplayerid,AdmGMHP[playerid]);   
          AdmGM [playerid]= 1;   
          AdmGMID [playerid]= giveplayerid;   
          CreateExplosion(boomx, boomy , boomz, 5, 0.5);  
          GmtestTimer [playerid]= SetTimerEx("Gmtest",1000,true,"d",playerid);  
          return true;   
      }

Создаём паблик:
Код
public Gmtest(playerid)  
{  
      new string[128], Float:nowhealth[MAX_PLAYERS];  
      if(AdmGM [playerid]== 1)  
      {  
          GetPlayerHealth(AdmGMID[playerid],nowhealth[AdmGMID[playerid]]);  
      }  
      if((AdmGMHP[playerid]-nowhealth[AdmGMID[playerid]]) > 0)  
      {  
          format(string, sizeof(string), "До: \t\t\t\t%.0f.0 HP\nПосле: \t\t\t%.0f.0 HP\nHP уменьшилось на: \t\t%.0f.0\n\n{7FB151}ГМ не обнаружено. HP игрока восстановлено.",AdmGMHP[playerid],nowhealth[AdmGMID[playerid]],(AdmGMHP[playerid]-nowhealth[AdmGMID[playerid]]));  
          ShowPlayerDialog(playerid,8888,DIALOG_STYLE_MSGBOX, "Проверка на God Mode",string, "Закрыть", "");  
          SetPlayerHealthAC(AdmGMID[playerid], AdmGMHP[playerid]);  
          AdmGM [playerid]= 0;  
          AdmGMHP [playerid]= 0;  
          AdmGMID [playerid]= INVALID_PLAYER_ID;  
       }  
       else if((AdmGMHP[playerid]-nowhealth[AdmGMID[playerid]]) == 0)  
       {  
          format(string, sizeof(string), "До: \t\t\t%.0f.0 HP\nПосле: \t\t%.0f.0 HP\nHP не уменьшилось\n\n{CD5A5A}Возможно этот игрок использует ГМ.",AdmGMHP[playerid],nowhealth[AdmGMID[playerid]]);  
          ShowPlayerDialog(playerid,8888,DIALOG_STYLE_MSGBOX, "Проверка God Mode",string, "Закрыть", "");  
          AdmGM [playerid]= 0;  
          AdmGMHP [playerid]= 0;  
          AdmGMID [playerid]= INVALID_PLAYER_ID;  
      }  
      KillTimer(GmtestTimer[playerid]);  
}

Автор: Неизвестен


Программист любитель :)
Форум » Программирование в Pawno » Готовые команды » /gm - Проверка на гм
  • Страница 1 из 1
  • 1
Поиск: