Mysql not loading admin level
#1

I had this problem a while ago... but dont remember how i fixed it. The server is not loading the admin level for some reason and I cant figure it out . I dont think it is loading anything from the second part.

Please could someone help?
Will +rep

Thanks

Код:
enum pInfo
{
	Name[23],
	Password[24],
	Cash,
	Bank,
	PH,
	Level,
	Skin,
	Float:PosX,
	Float:PosY,
	Float:PosZ,
	Int,
	VW,
	Job,
	Job2,
	Jail,
	Bail,
	Faction,
	FacRank,
	Phone,
	Mats,
	Pot,
	Crack,
	Heroin,
	VIPLevel,
	Moderator,
	Admin
}
Код:
stock LoadStats(playerid)
{
	new Query[1024], Query2[1024];
	format(Query, sizeof(Query), "SELECT * FROM playerdata WHERE Name = '%s'", GetName(playerid));
	mysql_query(Query);
	mysql_store_result();
	mysql_fetch_row_format(Query, "|");
	sscanf(Query, "p<|>s[23]s[24]dddddfffdddddd",
	PlayerInfo[playerid][Name],
	PlayerInfo[playerid][Password],
	PlayerInfo[playerid][Cash],
	PlayerInfo[playerid][Bank],
	PlayerInfo[playerid][PH],
	PlayerInfo[playerid][Level],
	PlayerInfo[playerid][Skin],
	PlayerInfo[playerid][PosX],
	PlayerInfo[playerid][PosY],
	PlayerInfo[playerid][PosZ],
	PlayerInfo[playerid][Int],
	PlayerInfo[playerid][VW],
	PlayerInfo[playerid][Job],
	PlayerInfo[playerid][Job2],
	PlayerInfo[playerid][Jail],
	PlayerInfo[playerid][Bail]);
	print("Loaded");
	mysql_free_result();
	
	format(Query2, sizeof(Query2), "SELECT * FROM playerdata WHERE Name = '%s'", GetName(playerid));
	mysql_query(Query2);
	mysql_store_result();
	mysql_fetch_row_format(Query2, "|");
	sscanf(Query2, "p<|>dddddddddd",
	PlayerInfo[playerid][Faction],
	PlayerInfo[playerid][FacRank],
	PlayerInfo[playerid][Phone],
	PlayerInfo[playerid][Mats],
	PlayerInfo[playerid][Pot],
	PlayerInfo[playerid][Crack],
	PlayerInfo[playerid][Heroin],
	PlayerInfo[playerid][VIPLevel],
	PlayerInfo[playerid][Moderator],
	PlayerInfo[playerid][Admin]);
	print("Loaded 2");
	mysql_free_result();
	return 1;
}
Reply
#2

I might go wrong at some place as i am new to MySQL.
Try this:

Код:
stock LoadStats(playerid)
{
	new Query[2084];
	format(Query, sizeof(Query), "SELECT * FROM playerdata WHERE Name = '%s'", GetName(playerid));
	mysql_query(Query);
	mysql_store_result();
	mysql_fetch_row_format(Query, "|");
	sscanf(Query, "p<|>s[23]s[24]dddddfffdddddd",
	PlayerInfo[playerid][Name],
	PlayerInfo[playerid][Password],
	PlayerInfo[playerid][Cash],
	PlayerInfo[playerid][Bank],
	PlayerInfo[playerid][PH],
	PlayerInfo[playerid][Level],
	PlayerInfo[playerid][Skin],
	PlayerInfo[playerid][PosX],
	PlayerInfo[playerid][PosY],
	PlayerInfo[playerid][PosZ],
	PlayerInfo[playerid][Int],
	PlayerInfo[playerid][VW],
	PlayerInfo[playerid][Job],
	PlayerInfo[playerid][Job2],
	PlayerInfo[playerid][Jail],
	PlayerInfo[playerid][Bail];
	PlayerInfo[playerid][Faction],
	PlayerInfo[playerid][FacRank],
	PlayerInfo[playerid][Phone],
	PlayerInfo[playerid][Mats],
	PlayerInfo[playerid][Pot],
	PlayerInfo[playerid][Crack],
	PlayerInfo[playerid][Heroin],
	PlayerInfo[playerid][VIPLevel],
	PlayerInfo[playerid][Admin],
	PlayerInfo[playerid][Moderator]);
	print("Loaded");
	mysql_free_result();
	return 1;
}
Regards,
UnknownOwner.
Reply
#3

Why are you using 2 queries to load the same info from the same database table?

and your queries are large, however you should only be using one query seeing as it could be done by one query.

I have never personally used scanff to separate by data from database as i setup my database in the correct way, but maybe removed it and trying without it, might work.

Also in query 2 for Faction Rank (I think should be a String), you put in Scanff D. Also chnage the enum for Faction Rank, "facRank" change to "facRank[60]"

Try going over your scanff separation and trying again.

Also remove the +Rep as people tend not to help if you add it to your topic.
Reply
#4

Azzerking could you try help me with this? How did you do it?
Reply
#5

Okay, Sure

First could you show me your database layout, as I will need to create the code setup to match the database names and variables.

just screenshot the page on any database viewer (PHPMyAdmin, HeidiSQL, etc)

and just screenshot the structure part (Not the where the actual data is).
Reply
#6

Here we go

Reply
#7

Bump
Reply
#8

Can anyone hel me please?

I still cant figure why its not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)