14.07.2010, 23:40
(
Последний раз редактировалось Manuel1948; 15.07.2010 в 00:07.
)
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.
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);
...
...


