04.01.2014, 16:15
Ok, so i converted, my script to mysql using BlueG's MySQL Plugin Version R5. Yeah, didnt really get the plugins R7+.
Here is my MySQL Login code. Everything In this stock except for the SCM without admin is not working.
What am I doing wrong? everything else including stats saving in the database is working but this login thingy isnt what am I doing wrong?
pawn Код:
stock MySQL_Login(playerid)
{
new query[300], exec[256], string[256];
format(query, sizeof(query), "SELECT * FROM `Accounts` WHERE `Nick` = '%s'", GetName(playerid));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
if(mysql_retrieve_row())
{
mysql_fetch_field_row(result,"Admin");
PlayerInfo[playerid][Admin] = strval(exec);
mysql_fetch_field_row(result,"Score");
PlayerInfo[playerid][Score] = strval(exec);
mysql_fetch_field_row(result,"Money");
PlayerInfo[playerid][Money] = strval(exec);
mysql_fetch_field_row(result,"Kills");
PlayerInfo[playerid][Kills] = strval(exec);
mysql_fetch_field_row(result,"Deaths");
PlayerInfo[playerid][Deaths] = strval(exec);
mysql_fetch_field_row(result,"Muted");
PlayerInfo[playerid][Muted] = strval(exec);
}
}
mysql_free_result();
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
PlayerInfo[playerid][Login] = 1;
if(PlayerInfo[playerid][Admin] >= 1)
{
format(string, sizeof(string), "[ACCOUNT] "cwhite"Successfully Logged in. Welcome Admin. Your Level is %d",PlayerInfo[playerid][Admin]);
SCM(playerid, xgreen, string);
}
else
{
format(string, sizeof(string), "[ACCOUNT] "cwhite"Successfully Logged in.");
SCM(playerid, xgreen, string);
}
return 1;
}
What am I doing wrong? everything else including stats saving in the database is working but this login thingy isnt what am I doing wrong?