[MySQL] ServerCrash - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [MySQL] ServerCrash (
/showthread.php?tid=159917)
[MySQL] ServerCrash -
Manuel1948 - 14.07.2010
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);
...
...
Re: [MySQL] ServerCrash -
[HiC]TheKiller - 15.07.2010
Use print after every line in the function and tell me where it fails.
AW: [MySQL] ServerCrash -
Manuel1948 - 15.07.2010
The problem was using a_sampmysql, I am now using a_mysql and there is no problem. Still thanks for your help.
Re: AW: [MySQL] ServerCrash -
ihatetn931 - 15.07.2010
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?