#Zippo
Дебютант
Я вот пишу систему бана, написал конфигурацию бана, запись в бан лист, но не работает, подскажите что сделать.
PHP:
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(PlayerInfo[params[0]][pAdmin] >= 1337) return SendClientMessage(playerid, -1, "Âû íå ìîæåòå çàáàíèòü åãî!");
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);
KickWithMessage(giveplayerid);
return true;}}return true;}
PHP:
stock AddBan(player, playerid[], giveplayerid[], type = 1, chislo = 0, reason[])
{
new totalban = 0;
switch(type)
{
case 1: totalban = 60*chislo; // ìèíóòû
case 2: totalban = 3600*chislo; // ÷àñû
case 3: totalban = 86400*chislo; // ñóòêè
default: totalban = chislo; // ñåêóíäû
}
new string[64];
format(string, sizeof(string), "banlist/%s.ini", playerid);
new OpenBan = ini_createFile(string);
if(OpenBan < 0) ini_openFile(string);
ini_setInteger(OpenBan, "BanTime", gettime());
ini_setInteger(OpenBan, "UnBanTime", gettime()+totalban);
ini_setString(OpenBan, "PlayerBan", giveplayerid);
ini_setString(OpenBan, "Reason", reason);
ini_closeFile(OpenBan); // Çàêðûâàåì ôàéë.
}
