[MySQL] ServerCrash
#1

Dear Scripter!
I have a problem with my OnPlayerLogin, which uses MySQL. It is a snippet of Moderntopia which I have edited in my script so, that MySQLFetchAcctRecord is used with playername instead of id. In OnplayerLogin it is the row with the comment //problem!!! which crashes my server. I have tested it with print("Check1,2..."). It crashes directly if the function is called I dont know why, also the Moderntopia-Script is crashing my server, no wonder the snippet is from it? Who can help me?

Sry for my bad English.

Код:
public MySQLFetchAcctRecord(sqlplayerid, sqlresult[]) // by Luk0r
{
	new query[64];
	format(query, sizeof(query), "SELECT * FROM players WHERE id = %d LIMIT 1", sqlplayerid);
	samp_mysql_query(query);
	samp_mysql_store_result();
	if(samp_mysql_fetch_row(sqlresult)==1)
	{
		return 1;
	}
	return 0;
}

public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
	MySQLCheckConnection();

		new Data[1024];
		new Field[64];
		new rcnt = 1; 
		MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);// problem!!!!
		samp_mysql_strtok(Field, "|", Data);
		while (samp_mysql_strtok(Field, "|", "")==1)
		{
                         if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
			 if (rcnt == 4) PlayerInfo[playerid][pAdmin] = strval(Field);
		   	 if (rcnt == 5) PlayerInfo[playerid][pDonateRank] = strval(Field);
			 if (rcnt == 6) PlayerInfo[playerid][gPupgrade] = strval(Field);
...
...
Reply
#2

Use print after every line in the function and tell me where it fails.
Reply
#3

The problem was using a_sampmysql, I am now using a_mysql and there is no problem. Still thanks for your help.
Reply
#4

Quote:
Originally Posted by Manuel1948
Посмотреть сообщение
The problem was using a_sampmysql, I am now using a_mysql and there is no problem. Still thanks for your help.
What did you change the samp_mysql_strtok to?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)