19.10.2013, 16:12
Fuck, your indentation is horrible and I hope you do have MySQL Experience the one you just did is totally WRONG not in MySQL but in your CALLBACKS
Fixed
Fixed
pawn Код:
public OnPlayerConnect(playerid)
{
mysql_format(1, query, "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 0,1", GetName(playerid));
mysql_function_query(1, query, true, "CheckPlayer", "i", playerid);
return 1;
}
// Kijkt of iemand in de database staat Vervolgens inloggen of registreren
forward CheckPlayer(playerid);
public CheckPlayer(playerid)
{
new rows, fields, string[128];
cache_get_data(rows, fields);
if(!rows)
{
format(string, sizeof(string), "{FFFFFF}Welcome {A3FF00}%s{FFFFFF} on my server. Input your password and register account.", GetName(playerid));
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Registration", string, "Registration", "Quit");
}
else
{
new temp[12];
cache_get_row(0, 1, temp); PlayerInfo[playerid][pSQLid] = strval(temp);
cache_get_row(0, 2, PlayerInfo[playerid][pPass]);
cache_get_row(0, 3, temp); PlayerInfo[playerid][pMoney] = strval(temp);
format(string, sizeof(string), "{FFFFFF}Welcome back {A3FF00}%s{FFFFFF}, your account is ready for use. Input your password and login.", GetName(playerid)); //<---one here
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Quit");
}
return 1;
}
//Maakt een row aan met account info en zet die vervolgens in de database
forward OnAccountCreate(playerid);
public OnAccountCreate(playerid)
{
PlayerInfo[playerid][pSQLid] = mysql_insert_id();
return 1;
}
//als iemand disconnect Shit opslaan in de database
public OnPlayerDisconnect(playerid, reason)
{
mysql_format(1, query, "UPDATE `players` SET `Money` = '%d' WHERE `Name` = '%e' LIMIT 1", GetPlayerMoney(playerid), GetName(playerid)); //<-- one error here
mysql_function_query(1, query, false, "", "");
return 1;
}