Discard something loaded
#1

I am using sscanf to load information from a MySQL database. I am loading something I don't need to save into a variable, it is more for the database. Is there a way to discard of the data, without saving it into a useless variable?
Reply
#2

Heres my load player
pawn Код:
stock LoadPlayer(playerid)
{
    new tmp[200];
    format(tmp, sizeof(tmp), "SELECT * FROM players WHERE username = '%s'", p_data[playerid][name]);
    mysql_query(tmp);
    mysql_store_result();
    if(mysql_num_rows() == 0) return printf("Failed to load data for %s he isn't registered!", p_data[playerid][name]);
    while(mysql_fetch_row_format(tmp,"|"))
    {
        sscanf(tmp, "p<|>i{s[24]s[24]s[24]}i",
        p_data[playerid][SQLID],
        p_data[playerid][admin]);
    }
    return printf("Player %s loaded, values admin = %d | kills = %d", p_data[playerid][name] ,p_data[playerid][admin]);
}
using { } around the fields you dont want to be used (in the sscanf line)
Reply
#3

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
Heres my load player
pawn Код:
stock LoadPlayer(playerid)
{
    new tmp[200];
    format(tmp, sizeof(tmp), "SELECT * FROM players WHERE username = '%s'", p_data[playerid][name]);
    mysql_query(tmp);
    mysql_store_result();
    if(mysql_num_rows() == 0) return printf("Failed to load data for %s he isn't registered!", p_data[playerid][name]);
    while(mysql_fetch_row_format(tmp,"|"))
    {
        sscanf(tmp, "p<|>i{s[24]s[24]s[24]}i",
        p_data[playerid][SQLID],
        p_data[playerid][admin]);
    }
    return printf("Player %s loaded, values admin = %d | kills = %d", p_data[playerid][name] ,p_data[playerid][admin]);
}
using { } around the fields you dont want to be used (in the sscanf line)
Oh awesome, thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)