SSCANF2 Loading Issue with MYSQL
#1

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.
Reply
#2

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

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)
Reply
#4

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?
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)