PDA

Просмотр полной версии : [Вопрос] Вопрос по команде /ban



Maxim_Saz
15.11.2017, 13:33
Помогите! Помогите сделать так, что бы если человек вводил айди администратора, то его снимало с админки!

if(strcmp(cmd, "/ban", true) == 0){
new giveplayerid = strval(tmp);
new string[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Используйте: /ban [ID] [кол-во] [причина]");
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Èñïîëüçóéòå: /ban [ID] [Кол-во] [причина]");
new chislo = strval(tmp);
if(PlayerInfo[playerid][pAdmin] >= 3){
if(giveplayerid != INVALID_PLAYER_ID){
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))){result[idx - offset] = cmdtext[idx];idx++;}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "Èñïîëüçóéòå: /ban [ID] [êîë-âî. äíåé] [ïðè÷èíà]");
new PlayerNick[MAX_PLAYER_NAME], PlayerBan[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerNick, MAX_PLAYER_NAME);
GetPlayerName(giveplayerid, PlayerBan, MAX_PLAYER_NAME);
format(string, sizeof(string), "Àäìèíèñòðàòîð %s çàáàíèë èãðîêà %s íà %d äíåé.Ïðè÷èíà: %s", PlayerNick, PlayerBan, chislo, result);
SendClientMessageToAll(0xeb3219AA,string);
AddBan(giveplayerid, PlayerBan, PlayerNick, 3, chislo, result);
KickWithMessage(giveplayerid);
return true;}}return true;}

DeimoS
15.11.2017, 13:47
Делаешь запрос в базу с введённым IP и смотришь, принадлежит ли он админу