Dr_Adik
Умник
В enum pinfo добавим
В public OnPlayerRegister(playerid, password[]) добавим
В public OnPlayerLogin(playerid,password[]
Теперь создадим команду
Далее сделаем так, чтобы игрока уведомляло о том что его забанили и на сколько
В OnPlayerConnect(playerid)
Ну и на этом всё !
PHP:
pBanTime,
pBanData
PHP:
format(var, 32, "BanTime=%d\n",PlayerInfo[playerid][pBanTime]);fwrite(hFile, var);
format(var, 32, "BanData=%d\n",PlayerInfo[playerid][pBanData]);fwrite(hFile, var);
PHP:
if( strcmp( key , "BanTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanTime] = strval( val ); }
if( strcmp( key , "BanData" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanData] = strval( val ); }
PHP:
if(strcmp(cmd, "/bant", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Используйте: /bant [ID] [Количество дней]");
return 1;
}
new giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Используйте: /bant [ID] [Количество дней]");
return 1;
}
new days = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
new curdate = getdate();
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Администратор %s забанил %s на %d дней.", sendername, giveplayer,days);
SendClientMessageToAll(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pBan] = 1;
PlayerInfo[giveplayerid][pBanTime] = curdate+days;
PlayerInfo[giveplayerid][pBanData] = curdate;
Kick(giveplayerid);
}
}
return 1;
}
PHP:
new curdate11 = getdate();
new string111[MAX_STRING];
if(PlayerInfo[playerid][pBanTime] > 0 && PlayerInfo[playerid][pBanData] < curdate11 && PlayerInfo[playerid][pBan] == 1)
{
new oldsrok = 365-PlayerInfo[playerid][pBanData];
new newdata = oldsrok+curdate11;
if(newdata >= PlayerInfo[playerid][pBanTime])
{
SendClientMessage(playerid, COLOR_YELLOW, "Вы отсидели свой срок бана, больше не нарушайте!");
PlayerInfo[playerid][pBan] = 0;
PlayerInfo[playerid][pBanTime] = 0;
PlayerInfo[playerid][pBanData] = 0;
}
}
if(PlayerInfo[playerid][pBanTime] > 0 && PlayerInfo[playerid][pBanTime] != curdate11 && PlayerInfo[playerid][pBan] == 1)
{
new ostalos=PlayerInfo[playerid][pBanTime]-curdate11;
SendClientMessage(playerid, COLOR_YELLOW, "Вы находитесь в бане.");
format(string111, sizeof(string111), "Вам осталось сидеть ещё %d дней.", ostalos);
SendClientMessage(playerid, COLOR_YELLOW, string111);
Kick(playerid);
return 1;
}
if(PlayerInfo[playerid][pBanTime] > 0 && PlayerInfo[playerid][pBanTime] == curdate11 && PlayerInfo[playerid][pBan] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "Вы отсидели свой срок бана, больше не нарушайте!");
PlayerInfo[playerid][pBan] = 0;
PlayerInfo[playerid][pBanTime] = 0;
PlayerInfo[playerid][pBanData] = 0;
}
PHP:
PlayerInfo[playerid][pBanTime] = 0;
PlayerInfo[playerid][pBanData] = 0;
