How can I converte my code with R7‘s mysql_function_query
#4

Simply call onMySQLCheckAccount with a playerid parameter, and store the id in a global variable.

example
pawn Code:
new gSQLid[MAX_PLAYERS];

public MySQLCheckAccount(playerid)
{
    new
        query[128],
        name[MAX_PLAYER_NAME];
       
    GetPlayerName(playerid, name, sizeof(name));
    mysql_format(query, sizeof(query), "SELECT id FROM users WHERE `Name` = '%s' LIMIT 1", name);
    mysql_function_query(Handel, query, true,"onMySQLCheckAccount", "d", playerid);
    return 1;
}

public onMySQLCheckAccount(playerid)
{
    new tmp[30];
    cache_field_content(0, "id", tmp); // The second parameter here is your field name
    gSQLid[playerid] = strval(tmp);
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)