MySQL offline ban not working -_-
#4

Quote:
Originally Posted by m1kas
Посмотреть сообщение
Код:
CMD:oban(playerid, params[]) 
{ 
    new name[24], reason[128], Query[155]; 
    if(sscanf(params, "s[24]s[128]", name, reason)) 
        return SCM(playerid, COR_CINZA, "Use: /oban [name] [reason]"); 

    mysql_format(g_SQL, Query, sizeof(Query), "SELECT id FROM players WHERE username = '%s' LIMIT 1", name); 
    mysql_tquery(g_SQL, Query, "OnPlayerOban", "iss", playerid, name, reason); 
    return 1; 
}

forward OnPlayerOBan(playerid, target[], offreason[]); 
public OnPlayerOBan(playerid, target[], offreason[]) 
{ 
    if(cache_num_rows() > 0) 
    { 
        new obanquery[256], admin[MAX_PLAYER_NAME],  banip[16], year, month, day, formatDate[12]; 

        cache_get_value_name(0, "ip", banip, 16); 
         
        GetPlayerName(playerid, admin, MAX_PLAYER_NAME); 

        getdate(year, month, day); 
        format(formatDate, 12, "%02d/%02d/%d", day, month, year); 

        mysql_format(g_SQL, obanquery, sizeof(obanquery), "INSERT INTO bans VALUES(NULL, '%s', '%s', '%s', '%s', '%s')",  target, admin, banip, formatDate, offreason); 
        mysql_tquery(g_SQL, obanquery); 

        SendClientMessageToAllEx(COLOR_LIGHTRED, "AdmCmd: %s banned %s, reason: %s", pNome(playerid), target, offreason); 
    } 
    else 
    { 
        SendClientMessage(playerid, COLOR_LIGHTRED, "[ERROR] That player isn't registered!"); 
    } 
    return 1; 
}
Should work perfectly fine if you have the banid automatically incremented, also the problem is that you are specifying a query to be the length of 128 cells, while you want to send a query of combined 152 cells (128 for reason, 24 for name). So never specify string lengths in threaded queries.
Nope, doesnt work. No errors on log, but when I input the cmd nothing happens.

EDIT: wait didnt seee the update, sorry ofr my stupidity.
Reply


Messages In This Thread
MySQL offline ban not working -_- - by insus100 - 18.03.2018, 00:01
Re: MySQL offline ban not working -_- - by m1kas - 18.03.2018, 00:14
Re: MySQL offline ban not working -_- - by insus100 - 18.03.2018, 00:19
Re: MySQL offline ban not working -_- - by insus100 - 18.03.2018, 00:29
Re: MySQL offline ban not working -_- - by insus100 - 18.03.2018, 00:40
Re: MySQL offline ban not working -_- - by m1kas - 18.03.2018, 00:49
Re: MySQL offline ban not working -_- - by insus100 - 18.03.2018, 00:52
Re: MySQL offline ban not working -_- - by UFF - 18.03.2018, 15:12
Re: MySQL offline ban not working -_- - by insus100 - 18.03.2018, 15:26
Re: MySQL offline ban not working -_- - by UFF - 18.03.2018, 15:40

Forum Jump:


Users browsing this thread: 1 Guest(s)