Creating an offline admin ban
#1

Hi. I've tried to make an offline admin ban (ban someone by "username" even that username doesn't exist, which inserts into mysql) but it gives me this errors
PHP код:

 error 035
argument type mismatch (argument 1)
 
error 035argument type mismatch (argument 1


PHP код:
MD: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);
        
jBan(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);
        
jBan(ban_target3playeridban_reason01);
    }
    else {
        
SendClientMessage(playerid,-1,""COL_RED"EROARE: U aint admin");
    }
    return 
1;

It gives me argument mismatch at "jBan"
Reply
#2

How is jBan defined?
Reply
#3

Quote:
Originally Posted by willbedie
Посмотреть сообщение
How is jBan defined?
PHP код:
stock jBan(player_bannedplayer_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_banned] == 0)
        {
            
gotBanned[player_banned] = 1;
            
format(jQueryMAX_QUERY_LENGTH"INSERT INTO `"#J_TABLE"` (user_banned, 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_banned] = 1;
            new 
strkick[180];
            
format(strkicksizeof(strkick), ""chat" Antichat %s (%i) for: %s"PlayerName(player_banned), player_bannedreason);
            
SendClientMessage(player_banned, -1""chat""COL_WHITE" If you feel like this is a mistake please, visit www.sampdayz.ro (Ban Appeals)");
            
SendClientMessageToAll(-1strkick);
            
KickEx(player_banned);
            
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_banned] == 0)
        {
            
gotBanned[player_banned] = 1;
            
format(jQueryMAX_QUERY_LENGTH"INSERT INTO `"#J_TABLE"` (user_banned, 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"""");
            new 
strkick[180];
            
format(strkicksizeof(strkick), ""chat""COL_WHITE" %s has banned you for: %s"GetAdminName(player_banner), reason);
            
SendClientMessage(player_banned, -1""chat""COL_WHITE" If you feel like this is a mistake please, visit www.sampdayz.ro (Ban Appeals)");
            
SendClientMessage(player_banned, -1strkick);
            
printf(jQuery);
            
KickEx(player_banned);
        }
    }
    return 
1;

Reply
#4

I think this only works for players that are online and not for offline ones, if you want to you can check on my signature my ban system, it has a /oban command and you can take examples from there.
Reply
#5

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
PHP код:
stock jBan(player_bannedplayer_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_banned] == 0)
        {
            
gotBanned[player_banned] = 1;
            
format(jQueryMAX_QUERY_LENGTH"INSERT INTO `"#J_TABLE"` (user_banned, 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_banned] = 1;
            new 
strkick[180];
            
format(strkicksizeof(strkick), ""chat" Antichat %s (%i) for: %s"PlayerName(player_banned), player_bannedreason);
            
SendClientMessage(player_banned, -1""chat""COL_WHITE" If you feel like this is a mistake please, visit www.sampdayz.ro (Ban Appeals)");
            
SendClientMessageToAll(-1strkick);
            
KickEx(player_banned);
            
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_banned] == 0)
        {
            
gotBanned[player_banned] = 1;
            
format(jQueryMAX_QUERY_LENGTH"INSERT INTO `"#J_TABLE"` (user_banned, 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"""");
            new 
strkick[180];
            
format(strkicksizeof(strkick), ""chat""COL_WHITE" %s has banned you for: %s"GetAdminName(player_banner), reason);
            
SendClientMessage(player_banned, -1""chat""COL_WHITE" If you feel like this is a mistake please, visit www.sampdayz.ro (Ban Appeals)");
            
SendClientMessage(player_banned, -1strkick);
            
printf(jQuery);
            
KickEx(player_banned);
        }
    }
    return 
1;

Create a new function (oBan or whatever) and add a string argument (player_name or so).
In that function simply execute the query jBan already uses, but instead of getting the name from a connected player you simply use the name given to the function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)