How to store strings? Player Accent...
#3

You can load the accent in to a string array instead, once the player has logged in or connected.

Variable declaration:
pawn Код:
new g_szPlayerAccent[MAX_PLAYERS][32];
Setting the player's accent value:
pawn Код:
strcat(g_szPlayerAccent[playerid], "Accent", 32); // Replace "Accent" with the string or accent text once the player connects
Getting the player's accent (in context):
pawn Код:
format(szMessage, sizeof(szMessage), "(%s accent) %s says: %s", g_szPlayerAccent[playerid], szPlayerName, szText);
So ultimately, based on the code you've shown us, this code can be added and called when the player logs in: (and should work)
pawn Код:
stock LoadPlayerAccent(playerid) {
    new
        szResult[32],
        szQuery[64];

    format(szQuery, sizeof(szQuery), "SELECT `Accent` FROM `accounts` WHERE `id` = %d", PlayerSQLID[playerid]);
    mysql_query(szQuery);

    mysql_store_result();

    while(mysql_retrieve_row()) {
        mysql_fetch_field_row(szResult, "Accent");
    }
    mysql_free_result();

    strcat(g_szPlayerAccent[playerid], szResult, 32);
    return 1;
}
Reply


Messages In This Thread
How to store strings? Player Accent... - by Dokins - 29.03.2014, 21:38
Re: How to store strings? Player Accent... - by Matess - 29.03.2014, 22:49
Re: How to store strings? Player Accent... - by Calgon - 29.03.2014, 22:54
Re: How to store strings? Player Accent... - by Konstantinos - 29.03.2014, 22:54
Re: How to store strings? Player Accent... - by Pottus - 29.03.2014, 23:44
Re: How to store strings? Player Accent... - by Dokins - 30.03.2014, 00:15

Forum Jump:


Users browsing this thread: 2 Guest(s)