10.07.2011, 04:26
(
Последний раз редактировалось Shadoww5; 10.07.2011 в 14:59.
)
I made this, but didn't test. Try:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ban", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You aren't a RCON Admin.");
new b[256], idx;
b = strtok(cmdtext, idx);
new player = strval(b);
if(!strlen(b)) return SendClientMessage(playerid, 0xFFFFFFFF, "USE: /ban [playerid] [time/hours]");
b = strtok(cmdtext, idx);
new time = strval(b);
if(!strlen(b)) return SendClientMessage(playerid, 0xFFFFFFFF, "USE: /ban [playerid] [time/hours]");
if(!IsPlayerConnected(player) || player == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "Invalid ID.");
if(time < 1) return SendClientMessage(playerid, 0xFF0000FF, "Iime must be greater than 0.");
SendClientMessage(player, 0xFFFF00FF, "You was banned.");
GetPlayerName(player, b, 24);
format(b, 35, "/Bans/%s.txt", b);
if(!fexist(b)) { dini_Create(b); }
dini_IntSet(b, "BanTime", (gettime()+(time*3600)));
Kick(player);
SendClientMessage(playerid, 0xFFFF00FF, "Player banned successfully.");
return 1;
}
return 0;
}
public OnPlayerSpawn(playerid)
{
new str[35];
GetPlayerName(playerid, str, 24);
format(str, 35, "/Bans/%s.txt", str);
if(fexist(str))
{
if(dini_Int(str, "BanTime") < gettime())
{
SendClientMessage(playerid, 0xFF0000FF, "You are still banned.");
Kick(playerid);
}
}
return 1;
}