MySQL Problem - Loading a float ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL Problem - Loading a float ? (
/showthread.php?tid=251409)
MySQL Problem - Loading a float ? -
GamingTurf - 26.04.2011
How am i able to load a float from MySQL ?
This is my current code, all works fine except from the floats.
pawn Код:
new data[2][50]; //The data strings
new data2[9]; //The data variables
sscanf(line, "p|ssddddddfff", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data2[4], data2[5], data2[6], data2[7], data2[8]); //Splits the line with sscanf
PInfo[playerid][Money] = data2[0];
PInfo[playerid][AdminLevel] = data2[1];
PInfo[playerid][Kills] = data2[2];
PInfo[playerid][Deaths] = data2[3];
PInfo[playerid][HoursPlayed] = data2[4];
PInfo[playerid][Interior] = data2[5];
PInfo[playerid][PosX] = data2[6];
PInfo[playerid][PosY] = data2[7];
PInfo[playerid][PosZ] = data2[8];
mysql_free_result();
Thanks for the help..
Re: MySQL Problem - Loading a float ? -
SchurmanCQC - 26.04.2011
I don't recommend using mysql_free_result().
Re: MySQL Problem - Loading a float ? -
GamingTurf - 26.04.2011
Quote:
Originally Posted by Schurman
I don't recommend using mysql_free_result().
|
Are you stupid?
It's loading statistics - it's an upcoming roleplay server so it's going to be pretty large when i'm finished with it.
I didn't ask for suggestions, i need the help..
Re: MySQL Problem - Loading a float ? - [L3th4l] - 26.04.2011
Create new variables to store the floats:
pawn Код:
new
Float:fVars[3];
sscanf(line, "p|ssddddddfff", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data2[4], data2[5], fVars[0], fVars[1], fVars[2]); //Splits the line with sscanf
PInfo[playerid][PosX] = fVars[0];
PInfo[playerid][PosY] = fVars[1];
PInfo[playerid][PosZ] = fVars[2];
Re: MySQL Problem - Loading a float ? -
SchurmanCQC - 26.04.2011
Make sure your pos' are marked with Float:
for example
pawn Код:
new Float:PosX,Float:PosY,Float:PosZ;
EDIT: fuck, Lethal beat me to it.
Re: MySQL Problem - Loading a float ? [FIXED] -
GamingTurf - 26.04.2011
Schurman that was no way correct, at all.
Thanks l3th4l, i'll try that now.
EDIT: Works perfectly - Thanks alot !