04.06.2010, 08:34
Hello guys. I have problems with my login script. My samp-server.exe crashes and there's nothing in server-log file.
Код:
public OnPlayerLogin(playerid,password[]) { MySQLCheckConnection(); new string[128]; MySQLFetchAcctSingle(GetPVarInt(playerid, "SQLID"), "Password", string); SetPVarString(playerid, "Passowrd", string); if(strcmp(ReturnPVarString(playerid, "Password"),password, true ) == 0 ) { new Data[1024]; new Field[64]; new rcnt = 1; MySQLFetchAcctRecord(GetPVarInt(playerid, "SQLID"), Data); samp_mysql_strtok(Field, "|", Data); SetPVarInt(playerid, "Logged", 1); while (samp_mysql_strtok(Field, "|", "")==1) { if (rcnt == 3) SetPVarInt(playerid, "AdminLevel", strval(Field)); rcnt++; } } else { ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_INPUT,"Login","Љifa koju ste unjeli nije\nvazeca. Pokusajte ponovno!","Login","Izlaz"); SetPVarInt(playerid, "LogTries", GetPVarInt(playerid, "LogTries") + 1); if(GetPVarInt(playerid, "LogTries") == 4) { SendClientMessage(playerid, ERROR_COLOR, "Previse puta ste unjeli pogresnu sifru. Kickani ste!"); Kick(playerid); } } return 1; }
Код:
public MySQLFetchAcctSingle(sqlplayerid, sqlvalname[], sqlresult[]) { new query[128]; format(query, sizeof(query), "SELECT %s FROM players WHERE id = %d LIMIT 1", sqlvalname, sqlplayerid); samp_mysql_query(query); samp_mysql_store_result(); if(samp_mysql_fetch_row(sqlresult)==1) { return 1; } return 0; } 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; }