Set Skin On Spawn -
Anthonyx3' - 12.01.2011
Hey guys, for some reason, when my character gets spawned, his skin automatically gets set to 0.
On my database it shows:
pawn Код:
Name Password Admin Money ppos_x ppos_y ppos_z Gender Level Skin
Abreezyy censored 0 0 -1969.48 130.9289 27.68750 1 0 29
But, when i actually set the skin it goes back to 0
pawn Код:
SetPlayerSkin(playerid, UserStats[playerid][Skin]);
Skin loading:
pawn Код:
if(mysql_fetch_row(str))
{
sscanf(str, "p<|>e<s[24]s[50]ddfffddd>", UserStats[playerid]);
}
mysql_free_result();
Any thoughts on problem and how to fix? Thanks in advance.
-Anthony
Re: Set Skin On Spawn -
Scenario - 12.01.2011
I responded to your question on the Andreas Market forums. Which MySQL plugin are you using? I know the issue, I just need to know the correct function to get you.
Re: Set Skin On Spawn -
Anthonyx3' - 12.01.2011
Oh i forgot i posted there, strikenkids
Re: Set Skin On Spawn -
Scenario - 12.01.2011
Okay, go ahead and see if this makes a difference.
pawn Код:
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(str, "|"))
{
sscanf(str, "p<|>e<s[24]s[50]ddfffddd>", UserStats[playerid]);
}
}
mysql_free_result();
EDIT: Actually, try this one if the one above doesn't work properly either.
pawn Код:
if(mysql_num_rows() > 0)
{
mysql_fetch_row(str, "|");
sscanf(str, "p<|>e<s[24]s[50]ddfffddd>", UserStats[playerid]);
}
mysql_free_result();
EDIT 2: Okay, so I reviewed the sscanf line over and over and realized I missed something. You had it messed up in the beginning. If the above don't work, try this:
pawn Код:
if(mysql_num_rows() > 0)
{
mysql_fetch_row(str, "|");
sscanf(str, "e<p<|>s[24]s[50]ddfffddd>", UserStats[playerid]);
}
mysql_free_result();
Re: Set Skin On Spawn -
Anthonyx3' - 12.01.2011
Negative, skin still gets set to 0
Edit: just saw your edit
Edit2: still didnt work :/
Re: Set Skin On Spawn -
Scenario - 12.01.2011
Quote:
Originally Posted by Anthonyx3'
Negative, skin still gets set to 0
Edit: just saw your edit
Edit2: still didnt work :/
|
Could you display your enum for player stats?
Re: Set Skin On Spawn -
Anthonyx3' - 12.01.2011
Sure
pawn Код:
enum pEnum
{
Name[MAX_PLAYER_NAME],
Password[32],
Admin,
Money,
Level,
Float:ppos_x[4],
Float:ppos_y[4],
Float:ppos_z[4],
Skin,
Gender
};
Also, id like to share these few lines from mysql log
pawn Код:
Function: mysql_fetch_row executed with result: "Abreezyy|tony|0|0|99.62181|-97.9576|1.330710|0|0|180".
Function: mysql_free_result executed.
shows skin is being loaded o.o
Re: Set Skin On Spawn -
Scenario - 12.01.2011
Quote:
Originally Posted by Anthonyx3'
Sure
pawn Код:
enum pEnum { Name[MAX_PLAYER_NAME], Password[32], Admin, Money, Level, Float:ppos_x[4], Float:ppos_y[4], Float:ppos_z[4], Skin, Gender };
Also, id like to share these few lines from mysql log
pawn Код:
Function: mysql_fetch_row executed with result: "Abreezyy|tony|0|0|99.62181|-97.9576|1.330710|0|0|180". Function: mysql_free_result executed.
shows skin is being loaded o.o
|
Just as I had expected; your enum doesn't match the format for the sscanf line or the MySQL database. They need to be in the EXACT same order, otherwise it won't work properly...
Re: Set Skin On Spawn -
Anthonyx3' - 12.01.2011
Oh...i didnt know that, lol
Re: Set Skin On Spawn -
Scenario - 12.01.2011
Quote:
Originally Posted by Anthonyx3'
Oh...i didnt know that, lol
|
I made the same exact mistake when I was learning MySQL awhile ago. Anyways, get them in the correct order and it should work properly.