GMT/Time is possibly no longer my problem, but...
#5

Quote:
Originally Posted by KinxpIn
Посмотреть сообщение
PHP код:
BanPlayer(playeridbanneridtime[] = "PERMANENT"reason[] = "No Reason Given")
{
    new 
query[256], ip[16], string[256];
    
UpdatePlayerData(playerid1);
    
GetPlayerIp(playeridip16);
    
mysql_format(g_SQLquerysizeof(query), "DROP EVENT IF EXISTS `%e`"GetName(bannerid));
    
mysql_tquery(g_SQLquery);
    
mysql_format(g_SQLquerysizeof(query), "INSERT INTO `bans`(`Username`, `BannedBy`, `BanReason`,`IpAddress`, `Date`) VALUES('%e', '%e', '%e', '%s', '%s')"GetName(playerid), GetName(bannerid), reasonipReturnDate());
    
mysql_tquery(g_SQLquery);
    
//strreplaceEx(string[], const find[], const replace[], bool:ignorecase=true, count=cellmax, maxlength=sizeof(string))
    //CREATE DEFINER=`root`@`localhost` EVENT `a` ON SCHEDULE AT '2018-12-19 15:09:43' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM `bans` WHERE `Username` = 'Alfa_Sufa'
    //CREATE DEFINER=`root`@`localhost` EVENT `Alfa_Sufa` ON SCHEDULE AT '2018-12-19 15:07:18' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM `bans` WHERE `Username` = 'Alfa_Sufa'
    
if(strcmp(time"PERMANENT"true))
    {
        
mysql_format(g_SQLquerysizeof(query), "CREATE EVENT `%e` ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL %s DO \
        DELETE FROM `bans` WHERE `Username` = '%e'"
GetName(playerid), timeGetName(playerid));
        
mysql_tquery(g_SQLquery);
    }
    if(!
mysql_errno(g_SQL))
    {
        
format(stringsizeof(string), "{FFFFFF}You are banned from this server\n{D93D3D}Username: {FFFFFF}%s\n{D93D3D}Banned by: {FFFFFF}%s\n{D93D3D}Ban Reason: {FFFFFF}%s\n{D93D3D}Date: {FFFFFF}%s"GetName(playerid), GetName(bannerid), reasonReturnDate());
        
Dialog_Show(playeridDIALOG_BANNEDDIALOG_STYLE_MSGBOX"Ban Info"string"Close""");  // Show this dialog to the player.
        
DelayedKick(playerid);
    }
    else
    {
        
SCM(banneridCOLOR_RED"Something wrong at ban query, please check the console");
        
printf("Query : %s"query);
    }
}
CMD:tempban(playeridparams[])
{
    if(
pInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, -1"SERVER: You are not authorized to use that command."); // If the player is not logged into rcon
    
if(BanToggle) return SCM(playeridCOLOR_LIGHTBLUE,"SERVER: {FFFFFF}That command is currently disabled, contact a level 4 to enable it.");
    new 
PlayerIP[17];
    new 
gpiddayreason[128], time[26], ntime[30];
    
GetPlayerIp(gpidPlayerIPsizeof(PlayerIP)); // We are going to get the target's IP with this.
    
if(sscanf(params"dds[128]S(No Reasons Given)[128]"gpiddaytimereason)) return SendClientMessage(playerid, -1"USAGE: /tempban [playerid] [time] [Sec/Min/Hour/Day/Week/Month/Year] [reason]"); // This will show the usage of the command after the player types /ban
    
else
    {
        if(
strcmp(time"Day"false) || strcmp(time"Hour"false) || strcmp(time"Min"false) || strcmp(time"Week"false) || strcmp(time"Sec"false) || strcmp(time"Year"false) || strcmp(time"Month"false))
        {
            
strreplaceEx(time"Sec""SECOND"false3026);    strreplaceEx(time"sec""SECOND"false3026);
            
strreplaceEx(time"Min""MINUTE"false3026);    strreplaceEx(time"min""MINUTE"false3026);
            
strreplaceEx(time"Hour""HOUR"false3026);    strreplaceEx(time"hour""HOUR"false3026);
            
strreplaceEx(time"Day""DAY"false3026);    strreplaceEx(time"day""DAY"false3026);
            
strreplaceEx(time"Week""WEEK"false3026);    strreplaceEx(time"week""WEEK"false3026);
            
strreplaceEx(time"Month""MONTH"false3026);    strreplaceEx(time"month""MONTH"false3026);
            
strreplaceEx(time"Year""YEAR"false3026);    strreplaceEx(time"year""YEAR"false3026);
            if(!
IsPlayerConnected(gpid)) return SendClientMessage(playerid, -1"That player is not connected"); // If the target is not connected.
            
if(IsPlayerAdmin(gpid)) return SCM(playeridCOLOR_WHITE"You can't ban Owner!");
            if(
pInfo[gpid][pAdmin] > pInfo[playerid][pAdmin]) return 0;
            if(
day && day 1000)
            {
                
format(ntimesizeof(ntime), "'%d' %s"daytime);
                
BanPlayer(gpidplayeridntimereason);
            }
            else 
SCM(playeridCOLOR_WHITE"Time must between 1 - 999");
        }
        else 
cmd_tempban(playerid"");
    }
    return 
1;

Use this.
Thanks, ReturnDate is what for? Can you send it?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)