MySQL Help (Loading Integers and such)
#1

Basically I wanna load Money, Admin Level, SkinID, and all that jazz. But it wont work. I got saving to work.. But loading doesn't.

Some useful code:
Quote:

enum pInfo
{
Admin,
Money,
Skin,

}

My Player Login:

Quote:

if(mysql_num_rows() != 0)
{
new pName1[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName1,sizeof(pName1));
format(query,sizeof(query),"SELECT * FROM `users` WHERE Username = '%s' LIMIT 1", pName1);
mysql_query(query);
mysql_store_result();

new resultline[512],player[6][11];
mysql_fetch_field_row(resultline,"|");
split(resultline, player, '|');

PlayerInfo[playerid][Admin] = strval(player[3]);
PlayerInfo[playerid][Money] = strval(player[4]);
PlayerInfo[playerid][Skin] = strval(player[5]);
Are these even right? I don't understand this part.


//other variables

mysql_free_result();
LoggedIn[playerid] = true;
SendClientMessage(playerid,GREY," You are now logged in!");
return 1;
}

Also it gives the money in this part(Doesn't work obviously):
Quote:

mysql_store_result();
if(mysql_num_rows() == 1)
{
PlayerInfo[LOGIN_PLAYER_ID][Money] = mysql_fetch_int();
PlayerInfo[LOGIN_PLAYER_ID][Skin] = mysql_fetch_int();
GivePlayerMoney(LOGIN_PLAYER_ID,PlayerInfo[LOGIN_PLAYER_ID][Money]);
SetPlayerSkin(LOGIN_PLAYER_ID,PlayerInfo[LOGIN_PLAYER_ID][Skin]);

Reply
#2

Try searching first ... http://forum.sa-mp.com/index.php?top...2943#msg802943
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)