BAN SYSTEM FOR TIME.
#3

I made this, but didn't test. Try:

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/ban"true) == 0)
    {
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You aren't a RCON Admin.");
        new 
b[256], idx;
        
strtok(cmdtextidx);
        new 
player strval(b);
        if(!
strlen(b)) return SendClientMessage(playerid0xFFFFFFFF"USE: /ban [playerid] [time/hours]");
        
strtok(cmdtextidx);
        new 
time strval(b);
        if(!
strlen(b)) return SendClientMessage(playerid0xFFFFFFFF"USE: /ban [playerid] [time/hours]");
        if(!
IsPlayerConnected(player) || player == INVALID_PLAYER_ID) return SendClientMessage(playerid0xFF0000FF"Invalid ID.");
        if(
time 1) return SendClientMessage(playerid0xFF0000FF"Iime must be greater than 0.");
        
SendClientMessage(player0xFFFF00FF"You was banned.");
        
GetPlayerName(playerb24);
        
format(b35"/Bans/%s.txt"b);
        if(!
fexist(b)) { dini_Create(b); }
        
dini_IntSet(b"BanTime", (gettime()+(time*3600)));
        
Kick(player);
        
SendClientMessage(playerid0xFFFF00FF"Player banned successfully.");
        return 
1;
    }
    return 
0;
}
public 
OnPlayerSpawn(playerid)
{
    new 
str[35];
    
GetPlayerName(playeridstr24);
    
format(str35"/Bans/%s.txt"str);
    if(
fexist(str))
    {
        if(
dini_Int(str"BanTime") < gettime())
        {
            
SendClientMessage(playerid0xFF0000FF"You are still banned.");
            
Kick(playerid);
        }
    }
    return 
1;

Reply


Messages In This Thread
BAN SYSTEM FOR TIME. - by budelis - 09.07.2011, 20:02
Re: BAN SYSTEM FOR TIME. - by budelis - 09.07.2011, 20:40
Re: BAN SYSTEM FOR TIME. - by Shadoww5 - 10.07.2011, 04:26
Re: BAN SYSTEM FOR TIME. - by Calgon - 10.07.2011, 04:33
Re: BAN SYSTEM FOR TIME. - by budelis - 10.07.2011, 08:35
Re: BAN SYSTEM FOR TIME. - by budelis - 10.07.2011, 09:07
Re: BAN SYSTEM FOR TIME. - by Shadoww5 - 10.07.2011, 12:52
Re: BAN SYSTEM FOR TIME. - by budelis - 18.07.2011, 07:15
Re: BAN SYSTEM FOR TIME. - by MoroDan - 18.07.2011, 08:04

Forum Jump:


Users browsing this thread: 2 Guest(s)