13.05.2018, 12:43
On my login system(mysql r39-6), whenever a player logins these 2 variables(Playa[playerid][Level], Playa[playerid][Respect]) gets values 101 and 0. I've rewritten the code for several times, same results. He're are some codes to look into
Here's checking password and things, now loadings:
The loadings are correct but when it shows me the variable result in server, it gets value 101.
Firstly, i thought there should be a format problem
but i've put under comments the code and same thing hapenned when i checked the database.
PHP код:
public OnPlayerConnect(playerid)
{
new clean[PlayerInfo]; Playa[playerid] = clean;
Playa[playerid][Vehicle] = -1; Playa[playerid][Level] = 1; Playa[playerid][Respect] = 1;
String[0] = '\0';
format(String, 128, "{FFFFFF}Welcome, {FF0000}%s{FFFFFF}!\nPlease select your language wich you will use to play on this server", SendName(playerid));
ShowPlayerDialog(playerid, AccD, DIALOG_STYLE_MSGBOX, "Language", String, "Romana", "English");
return 1;
}
PHP код:
case AccD: //Language
{
if(response)
{
Playa[playerid][Language] = 1; msQuery[0] = '\0';
mysql_format(Velocity, msQuery, 256, "SELECT * FROM `accounts` WHERE `Name` = '%s' LIMIT 1", SendName(playerid));
mysql_tquery(Velocity, msQuery, "CheckPlayerLogin", "d", playerid);
}
else
{
Playa[playerid][Language] = 0; msQuery[0] = '\0';
mysql_format(Velocity, msQuery, 256, "SELECT * FROM `accounts` WHERE `Name` = '%s' LIMIT 1", SendName(playerid));
mysql_tquery(Velocity, msQuery, "CheckPlayerLogin", "d", playerid);
}
PHP код:
Playa[playerid][Respect] = cache_get_field_content_int(0, "Respect", Velocity);
[17:45:50 05/08/18] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Respect", connection: 1
[17:45:50 05/08/18] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Respect", data: "1"
Playa[playerid][Level] = cache_get_field_content_int(0, "Level", Velocity);
[17:45:50 05/08/18] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Level", connection: 1
[17:45:50 05/08/18] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Level", data: "1"
Firstly, i thought there should be a format problem
PHP код:
format(String2, 150, "{FFFFFF}Level: {00FF00}%d\n", Playa[playerid][Level]);
strcat(String, String2);
format(String2, 150, "{FFFFFF}Respect Points: {00FF00}%d{FFFFFF}/{00FF00}%d\n\n", Playa[playerid][Respect], Playa[playerid][Level] * 3);
strcat(String, String2);
strcat(String, "{FFFFFF}For more statistics, use {FF0000}/stats{FFFFFF}.\n\n");