Bren
Умник
В чем причина не работает система
PHP:
if(strcmp(cmdtext,"/бан",true)==0)
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "[Ошибка]: >> Для использования данной команды вам необходимы дополнительные полномочия!");
{
tmp = strtok(cmdtext, idx);
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, YouCanNot);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREEN, "Используйте: /бан [id] [причина]");
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pAdmin] > 0) return SendClientMessage(playerid, COLOR_GRAD2, "[Ошибка]: >> Администратор не может быть забанен!");
new ip[15];
GetPlayerIp(giveplayerid,ip,15);
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
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_GREEN, "Используйте: /бан [id] [причина]");
for(new i;i < strlen(result);i++)
{
new a[2],c=0;
for(new j = 0;j < strlen(result);j++) //5
{
strmid(a,result,i+j,i+j+1,2);
if('0' <= a[0] <= '9')c+=1;
}
if(c == 9)
{
PlayerInfo[playerid][pAdmin] = 0;
SendClientMessage(playerid, 0xFFFFFFAA, " Слишком много цифр");
SendClientMessage(playerid, 0xFFFFFFAA, " Идет анализ твоего сообщения, ты снят с администраторских прав.");
format(string,sizeof(string)," Внимание: %s[%d] пытался отправить текст: %s",sendername, playerid, result);
ABroadCast(COLOR_YELLOW,string,1);
return 1;
}
}
new year, month,day;
getdate(year, month, day);
new curdate = getdate(year,month,day);
PlayerInfo[giveplayerid][pRp] -=20;
format(string, sizeof(string), "Администратор: %s забанил %s. Причина: {FFA500}[%s] ",sendername, giveplayer, (result));
SendClientMessageToAll(COLOR_LIGHTRED,string);
PlayerInfo[giveplayerid][pBanTime] = curdate+7;
PlayerInfo[giveplayerid][pBanData] = curdate;
format(string, sizeof(string), "banlist/%s.ini", tmp);
new File = ini_openFile(string);
ini_setInteger(File,"BanTime",curdate+7);
ini_setInteger(File,"BanTime",curdate);
ini_closeFile(File);
GetPlayerIp(giveplayerid,ip,sizeof(ip));
format(string, sizeof(string), "banlist/%s.ini",giveplayer);
new file = ini_openFile(string);
if(file < 0) print("нету файла");
else
{
ini_getString(file,"pIp",string);
ini_getString(file,"pIpReg",string);
printf("найдено же - %s , началось чтение файла с этим именем",string);
ini_closeFile(file);
format(string, sizeof(string), "- Ник: [%s] | IP: [%s] | R: [IP: %s] | L: [IP: %s]",giveplayer,ip,string,string);
ABroadCast(COLOR_LIGHTRED,string,1);
PlayerInfo[giveplayerid][pLocked] = 1;
kicknew(giveplayerid);
}
return true;
}
}//not connected
}
else
{
SendClientMessage(playerid, COLOR_RED, "[Ошибка]: >> Данный игрок не найден");
}
}
return true;
}
