Posts: 134
Threads: 32
Joined: Dec 2007
Reputation:
0
mysql_fetch_row_format(line, "|");
sscanf(line, "p|dssddsddffffddddddddddddddddd",
PlayerInfo[playerid][name],
PlayerInfo[playerid][password],
PlayerInfo[playerid][age],
etc, etc, etc......);
mysql_free_result();
Q: How would I set this up so that these variables go into PVar's?
I assume that I cannot swap SetPVarInt(playerid, "name") with PlayerInfo[playerid][name]... right?
Posts: 214
Threads: 1
Joined: May 2010
Reputation:
0
You need to store it in a temporary variable first and then call the SetPVar... function.
Posts: 167
Threads: 0
Joined: Aug 2009
Reputation:
0
You can use SetPVarString(playerid, varname[], string_value[]);
Posts: 134
Threads: 32
Joined: Dec 2007
Reputation:
0
How would you write something like that?
Posts: 214
Threads: 1
Joined: May 2010
Reputation:
0
Well either you create as many variables as you need (which will be a very bad solution regarding the amount you'd need) or you grab your result string and split it step-by-step while writing each splitted part in only one temporary variable.
Posts: 134
Threads: 32
Joined: Dec 2007
Reputation:
0
Can you please show me an example with my code from the first post?
Posts: 214
Threads: 1
Joined: May 2010
Reputation:
0
Sorry no time to make a custom build function right now, but one idea:
Rebuild the strtok function to split the string using "|" as its delimiter. You got it somewhere in your script.
Posts: 214
Threads: 1
Joined: May 2010
Reputation:
0
Does it still crash the server when doing this on a windows machine Serg?