SA-MP Forums Archive
SSCANF2 Loading Issue with MYSQL - 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)
+--- Thread: SSCANF2 Loading Issue with MYSQL (/showthread.php?tid=315126)



SSCANF2 Loading Issue with MYSQL - Abreezy - 01.02.2012

Alright as the title says, I'm having difficulties loading with SSCANF2 from MYSQL Database. Let's start off by showing you the issue:

The printfs from ingame:

pawn Код:
[17:09:25] 0 position has been loaded to: 0.000000 , 0.000000, 0.000000
[17:09:25] 0 Skin has been set as 0
Let me explain incase you don't understand, 0 = Playerid, the 0.0000 is the x,y,z, The second 0 on the second line is the skinid.

This is the account on the database information.

pawn Код:
Username    Password    Skin    X   Y   Z
     Tyrone_Williams    censored    25  209.386 -64.907 1.57812
That's the actual information, so now you see the issue..here's the loading code using sscanf2:

pawn Код:
if(mysql_num_rows() != 0)
                {
                    mysql_fetch_row_format(query, "|");
                    sscanf(query, "e<p<|>ifff>", PlayerInfo[playerid]);
                   

                    SetSpawnInfo(playerid, 0, PlayerInfo[playerid][Skin], PlayerInfo[playerid][Posx], PlayerInfo[playerid][Posy], PlayerInfo[playerid][Posz], 0, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                    printf("%i position has been loaded to: %f , %f, %f", playerid, PlayerInfo[playerid][Posx],PlayerInfo[playerid][Posy],PlayerInfo[playerid][Posz]);
                    SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
                    printf("%i Skin has been set as %d", playerid, playerskin);
                    mysql_free_result();
                    SendClientMessage(playerid, -1, "Loaded using sscanf - Debug testing.");
                }
Thanks in advance for anyone who helps fix the issue.


Re: SSCANF2 Loading Issue with MYSQL - Abreezy - 01.02.2012

Just to show the debug text:
pawn Код:
CMySQLHandler::FetchRow() - Return: Tyrone_Williams|censored|25|226.186|-109.285|1.57812



Re: SSCANF2 Loading Issue with MYSQL - DRIFT_HUNTER - 01.02.2012

And player enum ?
EDIT:

I guess you have in enum Skin,x,y,z
Only that and in that order.


sscanf(query, "e<p<|>{s[24]}{s[24]}ifff>", PlayerInfo[playerid]);

{} in sscanf is called Quiet (It will be checked but not saved)


Re: SSCANF2 Loading Issue with MYSQL - Abreezy - 01.02.2012

Yeah I only have skin, posx posy posz. Where does your s[24] come from? And why do i need the quiet thing, what's the use of it?


Re: SSCANF2 Loading Issue with MYSQL - Abreezy - 02.02.2012

Sorry for bump, but this is holding my scripting back so much . Someone please help, thanks. You could tell me my code is fully wrong or anything. I just need advice on how to fix this.