public OnAccountLoad(playerid) { PlayerInfo[playerid][pAdminLevel] = cache_get_field_content_int(0, "AdminLevel"); TogglePlayerSpectating(playerid, false); SpawnPlayer(playerid); SendClientMessage(playerid, -1, "You have successfully logged in."); return 1; } public OnAccountCheck(playerid) { new rows, fields; cache_get_data(rows, fields, mysql); if(rows) { cache_get_field_content(0, "Password", PlayerInfo[playerid][Password], mysql, 129); ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Welcome player!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit"); } else { ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit"); } return 1; }
[14:26:37] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET `AdminLevel` = '%d' WHERE `Name` = '%e'" [14:26:37] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `AdminLevel` = '4' WHERE `Name` = 'Aspire5", callback: "(null)", format: "(null)" [14:26:37] [DEBUG] CMySQLQuery::Execute[] - starting query execution [14:26:37] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 66.489 milliseconds [14:26:37] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [14:28:15] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "myserver", password: "****", port: 3306, autoreconnect: true, pool_size: 2 [14:28:15] [DEBUG] CMySQLHandle::Create - creating new connection.. [14:28:15] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called [14:28:15] [DEBUG] CMySQLHandle::Create - connection created (id: 1) [14:28:15] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:28:15] [DEBUG] CMySQLConnection::Connect - connection was successful [14:28:15] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:28:15] [DEBUG] mysql_errno - connection: 1 [14:28:15] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:28:15] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [14:28:15] [DEBUG] CMySQLConnection::Connect - connection was successful [14:28:15] [DEBUG] CMySQLConnection::Connect - connection was successful [14:28:15] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:28:15] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [14:28:33] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `Name` FROM `accounts` WHERE `Name` = '%e' LIMIT 1" [14:28:33] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `Name` FROM `accounts` WHERE `Name` = 'Aspire", callback: "OnAccountCheck", format: "i" [14:28:33] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution [14:28:33] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.465 milliseconds [14:28:33] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [14:28:33] [DEBUG] Calling callback "OnAccountCheck".. [14:28:33] [DEBUG] cache_get_data - connection: 1 [14:28:33] [DEBUG] cache_get_field_content - row: 0, field_name: "Password", connection: 1, max_len: 129 [14:28:33] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Password", data: "50A09AF1575142623B1F8ABE28B433E108D6E8FCB3C7150F36DA7D0A359E22B7078EDC245278C84BEB1D3E634058D322399B9D29E2983F803C3F8B48507EC01E" [14:28:33] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [14:28:35] [DEBUG] mysql_format - connection: 1, len: 100, format: "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1" [14:28:35] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `accounts` WHERE `Name` = 'Aspire5630' LIMIT 1", callback: "OnAccountLoad", format: "i" [14:28:35] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - starting query execution [14:28:35] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - query was successfully executed within 0.346 milliseconds [14:28:35] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [14:28:35] [DEBUG] Calling callback "OnAccountLoad".. [14:28:35] [DEBUG] cache_get_field_content_int - row: 2, field_name: "AdminLevel", connection: 1 [14:28:35] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('2') [14:28:35] [ERROR] cache_get_field_content_int - invalid datatype [14:28:35] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [14:28:39] [DEBUG] mysql_format - connection: 1, len: 128, format: "UPDATE `accounts` SET `AdminLevel` = '%d' WHERE `Name` = '%e'" [14:28:39] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `accounts` SET `AdminLevel` = '0' WHERE `Name` = 'Aspire5", callback: "(null)", format: "(null)" [14:28:39] [DEBUG] CMySQLQuery::Execute[] - starting query execution [14:28:39] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 61.463 milliseconds [14:28:39] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
CMD:setlevel(playerid, params[])
{
PlayerInfo[playerid][pAdminLevel] = 3; // assuming you want to be level 3
return 1;
}
Are you sure you're setting the adminlevel right in your set admin level command?
e.g: PHP код:
|
public OnAccountLoad(playerid)
{
new query[128];
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE Name = '%e'", GetPlayerNameEx(playerid, 0)); // replace getplayernameex with your own function
new Cache:result = mysql_query(MySQL_Connection, query); // replace mysql_connection with your own
new count = cache_get_row_count();
for(new i = 0; i < count; i++)
{
PlayerInfo[playerid][pAdminLevel] = cache_get_field_content_int(0, "AdminLevel");
}
TogglePlayerSpectating(playerid, false);
SpawnPlayer(playerid);
SendClientMessage(playerid, -1, "You have successfully logged in.");
return 1;
}
[14:28:35] [DEBUG] cache_get_field_content_int - row: 2, field_name: "AdminLevel", connection: 1
[14:28:35] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('2')
[14:28:35] [DEBUG] cache_get_field_content_int - row: 2, field_name: "AdminLevel", connection: 1
[14:28:35] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('2')
PHP код:
|