/offmembers [MySQL R39-2 / DC_CMD] - Форум Cheat-Master.ru
  • Страница 1 из 1
  • 1
Модератор форума: Phoenixxx_Czar, Getbackthere, [CM]OlegEhtler  
/offmembers [MySQL R39-2 / DC_CMD]
A7X Дата: Вторник, 03.05.2016, 22:11 | Сообщение # 1
Боец
Сообщений: 210
Статус: Offline
Привет.
В данном уроке я покажу вам систему управления offline игроками.
Данный урок рекомендуется более-менее опытным юзерам pawno, которые хоть немного понимают в MySQL.

Начнём.

Добавляем команду:
(все значения database, leader, member, rank меняем на свои)

Код
CMD:offmembers(playerid, params[])
{
    if(PlayerInfo[playerid][Leader] == 0) return SendClientMessage(playerid, COLOR_GREY, "Вы не можете использовать эту команду.");
    mysql_format(database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Member` = '%d' AND `Rank` <= %d", PlayerInfo[playerid][Member], PlayerInfo[playerid][Rank]-1);
    mysql_function_query(database, query, true, "get_offline_members", "i", playerid);
    return true;
}


Создадим переменную:

Код
new DialogSlotStr[MAX_PLAYERS][30][24];


Далее добавляем паблик который был объявлен в запросе:

Код
public get_offline_members(playerid)
{
    new rows, fields, playername[24], rank; cache_get_data(rows, fields);
    if(!rows) return SendClientMessage(playerid, COLOR_GREY, "Совпадений не найдено");
    
    static list[1000];
    list = "Имя\tРанг";
    
  for(new i; i < rows; i++)
    {
         cache_get_field_content(i, "Name", playername);
         rank = cache_get_field_content_int(i, "Rank");

  format(list, sizeof(list), "%s\n%s\t%d", list, playername, rank);
  format(DialogSlotStr[playerid][i], 24, playername);
    }
    ShowPlayerDialog(playerid, 9, DIALOG_STYLE_TABLIST_HEADERS, "{AAC5E3}Игроки не в сети", list, "Выбрать", "Закрыть");
    return true;
}


Отлично, с загрузкой offline игроков мы закончили. Теперь мы сделаем некую панель управления, где игроку можно будет изменить ранг или уволить.

Добавляем в public OnDialogResponse диалоги:

Код
case 9:
        {
            if(!response) return true;
            SetPVarInt(playerid,"dialogID", listitem), SetPVarString(playerid,"Nemses", inputtext);
            ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Панель управления", "- Уволить игрока\n- Повысить / понизить", "Далее", "Назад");
   return true;
        }


Код
case 10:
  {
         if(!response) return true;
         switch(listitem)
         {
          case 0:
      {
          new string[50];
     format(string, 50, "{FFFFFF}Вы действительно хотите уволить игрока %s", DialogSlotStr[playerid][listitem]);
     ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{FF8300}Панель управления", string, "Да", "Нет");
       }
    case 1: ShowPlayerDialog(playerid, 12, DIALOG_STYLE_INPUT, "Панель управления", "{FFFFFF}Введите новый ранг для игрока", "Далее", "Назад");
   }
   return true;
   }


Код
case 11:
  {
      if(!response) return true;
      mysql_format(database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%s'", DialogSlotStr[playerid][GetPVarInt(playerid, "dialogID")]);
   mysql_function_query(database, query, true, "offuninvite_player", "ds",playerid,DialogSlotStr[playerid][GetPVarInt(playerid, "dialogID")]);
   return true;
  }


Код
case 12:
  {
      if(!response) return true;
   new rank = strval(inputtext), playerName[MAX_PLAYER_NAME+1];
      GetPVarString(playerid, "Nemses", playerName, MAX_PLAYER_NAME+1);
      
      if(rank < 1 || rank >= PlayerInfo[playerid][Rank])
   {
    ShowPlayerDialog(playerid, 12, DIALOG_STYLE_INPUT, "Панель управления", "{FFFFFF}Введите новый ранг для игрока", "Далее", "Назад");
    return true;
   }
      mysql_format(database, query, sizeof(query), "UPDATE `accounts` SET Rank = '%i' WHERE Name = '%s'", rank, playerName);
      mysql_function_query(database, query, true, "", "");
   return true;
  }


В case 11: использовался public offuninvite_player. Добавляем.

Код
public offuninvite_player(playerid, tmp[])
{
    new rows, fields; cache_get_data(rows, fields);
    mysql_format(database, query, sizeof(query), "UPDATE `accounts` SET `Member` = '0', `Rank` = '0' WHERE `Name` = '%s'", tmp);
    mysql_function_query(database, query, false, "", "");
    SendClientMessage(playerid, COLOR_GREY, "Игрок уволен.");
    return true;
}


Вот собственно и всё.
Оптимизация / доработка на ваше усмотрение.
Ах, да и не забудьте сменить id'ы диалогов.

Спасибо за внимание.


2000 дней на сайте.
Читер СМ с 21.01.2015 - 14.09.2016
●Black_Day● Дата: Суббота, 07.05.2016, 14:55 | Сообщение # 2
Боец
Сообщений: 83
Статус: Offline
A7X, полезный урок,спасибо большое )

© 2009-2016 CM для всех
MILLIGAN4Ik Дата: Суббота, 07.05.2016, 14:55 | Сообщение # 3
Новичок
Сообщений: 12
Статус: Offline
Хороший урок

10 дней на CM [✖] 10 репутации на CM [✖] Новичок [✓]
25 дней на CM [✖] 25 репутации на CM [✖] Любитель [✖]
50 дней на CM [✖] 50 репутации на CM [✖] Боец [✖]
100 дней на CM [✖] 100 репутации на CM [✖] Боец(х2) [✖]
250 дней на CM [✖] 250 репутации на CM [✖] Бывалый [✖]
500 дней на CM [✖] 500 репутации на CM [✓] Знаток [✓]
600 дней на CM [✖] 600 репутации на CM [✓] Советник [✖]
800 дней на CM [✖] 800 репутации на CM [✖]] Авторитет [✖]
900 дней на CM [✖] 900 репутации на CM [✖] Легенда [✖]
1000+ дней на CM [✖] 1000+ репутации на CM [✖] Cheat-master [✖]
Maks5 Дата: Воскресенье, 15.05.2016, 05:04 | Сообщение # 4
Новичок
Сообщений: 15
Статус: Offline
Автор не ты. Укажи автора.
Dantes_rus Дата: Суббота, 21.05.2016, 21:47 | Сообщение # 5
Боец
Сообщений: 52
Статус: Offline
Код
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(1225) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(1225) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2634) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2671) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2705) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2739) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2780) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2817) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2858) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(2911) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(3006) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(3054) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(3183) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(3235) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(4621) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(4631) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(4640) : warning 219: local variable "rank" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(4647) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(4941) : warning 219: local variable "rank" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(4942) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(5124) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(7862) : warning 219: local variable "list" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11077) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11132) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11132) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11150) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11150) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11187) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11187) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11210) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11210) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11233) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11233) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11300) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11300) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11370) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(11370) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(12053) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(18613) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(19859) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(20662) : warning 219: local variable "rank" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(22196) : warning 219: local variable "rank" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(23050) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(23050) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(23151) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(23151) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(25672) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(25679) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(25686) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(25814) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(25855) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(25855) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26206) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26206) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26225) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26225) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26244) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26244) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26261) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26261) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26487) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26487) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(26615) : warning 219: local variable "query" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27350) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27350) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27705) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27705) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27726) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27726) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27740) : warning 219: local variable "rows" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27740) : warning 219: local variable "fields" shadows a variable at a preceding level
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27854) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27856) : error 021: symbol already defined: "cache_get_data"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27857) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27860) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27862) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27867) : error 021: symbol already defined: "format"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27871) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27875) : error 021: symbol already defined: "rows"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27875) : error 021: symbol already defined: "fields"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27877) : error 021: symbol already defined: "format"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27880) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27889) : warning 203: symbol is never used: "fields"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27889) : warning 203: symbol is never used: "list"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27889) : warning 203: symbol is never used: "playername"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27889) : warning 203: symbol is never used: "query"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27889) : warning 203: symbol is never used: "rank"
C:\Users\Admin\Desktop\Simple\gamemodes\NoName.pwn(27889) : warning 203: symbol is never used: "rows"

KЕГ
[CM]Desi Дата: Воскресенье, 22.05.2016, 21:20 | Сообщение # 6
Советник
Сообщений: 63
Статус: Offline
Dantes_rus, Там ты поменяй все под свой мод
HeavenMasteR Дата: Воскресенье, 05.06.2016, 16:49 | Сообщение # 7
Боец
Сообщений: 64
Статус: Offline
Круто,для меня самое то спасибо )
  • Страница 1 из 1
  • 1
Поиск: