Creating a stock of offline ban
#1

PHP код:
stock offlineban(player_nameplayer_bannerreason[], time 0system 0)
{
    if(
system == 0)
    {
        if(
strlen(reason) > MAX_REASON_LENGTH) return SendClientMessage(player_banner0xFFFFFF""chat" Sorry, the maximum reason length is "#MAX_REASON_LENGTH" characters!");
        
if(gotBanned[player_name] == 0)
        {
            
gotBanned[player_name] = 1;
            
format(jQueryMAX_QUERY_LENGTH"INSERT INTO `"#J_TABLE"` (player_name, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', 'System', '%s', CURRENT_TIMESTAMP, %d)", jNames[player_banned], jIP[player_banned], reason, time);
            
mysql_tquery(handlejQuery"""");
            
gotBanned[player_name] = 1;
            
printf(jQuery);
        }
    }
    else
    {
        if(
strlen(reason) > MAX_REASON_LENGTH) return SendClientMessage(player_banner0xFFFFFF""chat" Sorry, the maximum reason length is "#MAX_REASON_LENGTH" characters!");
        
if(gotBanned[player_name] == 0)
        {
            
gotBanned[player_name] = 1;
            
format(jQueryMAX_QUERY_LENGTH"INSERT INTO `"#J_TABLE"` (player_name, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', '%s', '%s', CURRENT_TIMESTAMP, %d)", jNames[player_banned], jIP[player_banned], jNames[player_banner], reason, time);
            
mysql_tquery(handlejQuery"""");
            
printf(jQuery);
            
KickEx(player_banned);
        }
    }
    return 
1;

PHP код:
CMD:offlinetban(playeridparams[]) 

    if(
pInfo[playerid][pAdminLevel] >= 2
    { 
        new 
ban_target2[24], string[128]; 
          if(
sscanf(params"s[24]"ban_targetban_timeban_reason)) return SendClientMessage(playerid, -1,""COL_RED"AdmCmds: /offlineban [Nickname] [Days] [Reason]"); 
        
format(stringsizeof(string),"*COL_RED*""%s %s has banned %s for %i days [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),ban_targetban_timeban_reason); 
        
SendClientMessageToAll(-1string); 
        
offlineban(ban_target2playeridban_reasonban_time1); 
    } 
    else { 
        
SendClientMessage(playerid,-1,""COL_RED"EROARE: U aint admin!"); 
    } 
    return 
1

CMD:offlineban(playeridparams[]) 

    if(
pInfo[playerid][pAdminLevel] >= 2
    { 
        new 
ban_target3[24], string[128]; 
        if(
sscanf(params"s[24]"ban_target3)) return SendClientMessage(playerid, -1,""COL_RED"AdmCmds: /offlineban [Nickname]"); 
        
format(stringsizeof(string), ""COL_RED"AdmCmds: %s %s  has  permanent  banned %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),ban_target3ban_reason); 
        
SendClientMessageToAll(-1string); 
        
offlineban(ban_target3playeridban_reason01); 
    } 
    else { 
        
SendClientMessage(playerid,-1,""COL_RED"EROARE: U aint admin"); 
    } 
    return 
1

My question is, if I ban someone by it's username even if he's not online, how can stock detect his IP from mysql?


ex. in mysql username: Zeus. IP: 160.0.0.0


In Game command: /offlinetban Zeus 5(days) Reason

but how can script detects zeus's IP if he's not online?
Reply


Messages In This Thread
Creating a stock of offline ban - by Zeus666 - 20.09.2018, 15:10
Re: Creating a stock of offline ban - by v1k1nG - 20.09.2018, 15:21
Re: Creating a stock of offline ban - by Zeus666 - 20.09.2018, 15:42
Re: Creating a stock of offline ban - by UFF - 20.09.2018, 16:07
Re: Creating a stock of offline ban - by solstice_ - 20.09.2018, 16:10
Re: Creating a stock of offline ban - by Zeus666 - 20.09.2018, 16:47
Re: Creating a stock of offline ban - by Calisthenics - 20.09.2018, 17:31

Forum Jump:


Users browsing this thread: 2 Guest(s)