08.01.2014, 22:40
Idk why but it doenst loads the money, and the other data from the players account, whats wrong here?
pawn Код:
stock MySQL_Login(playerid, passwordstring[])
{
if (PLAYERLIST_authed[playerid])
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Already authed.");
return 1;
}
if(strlen(passwordstring) > 32 || !strlen(passwordstring))
{
//ircecho("unformatted %s(%d) Typed too long password",PlayerName(playerid),playerid);
SendClientMessage(playerid,COLOR_SYSTEM_GM," Invalid password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, " Censured | Account Login", "Please enter your password in order to login.\n\nIf you have lost it, please contact us on forums", "Login", " ");
return 1;
}
/*================================================
MySQL Fetch for account
==================================================*/
new query[300], pname[24], savingstring[20];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT * FROM `players` WHERE Name='%s' LIMIT 1", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(savingstring, "bank");
PlayerInfo[playerid][bank] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "sm");
PlayerInfo[playerid][sm] = strval(savingstring);
GivePlayerMoney(playerid, strval(savingstring));
//=====================================================================================
mysql_fetch_field_row(savingstring, "playerlvl");
PlayerInfo[playerid][playerlvl] = strval(savingstring);
SetPlayerScore(playerid, strval(savingstring));
//=====================================================================================
mysql_fetch_field_row(savingstring, "rpoints");
PlayerInfo[playerid][rpoints] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "playertime");
PlayerInfo[playerid][playertime] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "jail");
PlayerInfo[playerid][jail] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "jailreason");
strmid(PlayerInfo[playerid][jailreason], savingstring, 0, strlen(savingstring), 50);
//=====================================================================================
mysql_fetch_field_row(savingstring, "jailtime");
PlayerInfo[playerid][jailtime] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "banned");
PlayerInfo[playerid][banned] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "banreason");
strmid(PlayerInfo[playerid][banreason], savingstring, 0, strlen(savingstring), 50);
//=====================================================================================
mysql_fetch_field_row(savingstring, "whobannedme");
strmid(PlayerInfo[playerid][whobannedme], savingstring, 0, strlen(savingstring), 50);
//=====================================================================================
mysql_fetch_field_row(savingstring, "whenigotbanned");
strmid(PlayerInfo[playerid][whenigotbanned], savingstring, 0, strlen(savingstring), 50);
//=====================================================================================
/*mysql_fetch_field_row(savingstring, "forumname");
strmid(PlayerInfo[playerid][forumname], savingstring, 0, strlen(savingstring), 50);*/
//=====================================================================================
mysql_fetch_field_row(savingstring, "Skin");
PlayerInfo[playerid][Skin] = strval(savingstring);
SetPlayerSkin(playerid, strval(savingstring));
//=====================================================================================
mysql_fetch_field_row(savingstring, "ranklvl");
PlayerInfo[playerid][ranklvl] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "rentprice");
PlayerInfo[playerid][rentprice] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "driverlic");
PlayerInfo[playerid][driverlic] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "flylic");
PlayerInfo[playerid][flylic] = strval(savingstring);
//=====================================================================================
/* mysql_fetch_field_row(savingstring, "namechanges");
PlayerInfo[playerid][namechanges] = strval(savingstring);*/
//=====================================================================================
// mysql_fetch_field_row(savingstring, "recieved");
// PlayerInfo[playerid][recieved] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "boatlic");
PlayerInfo[playerid][boatlic] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "weaplic");
PlayerInfo[playerid][weaplic] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "jobtime");
PlayerInfo[playerid][jobtime] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "jobskill");
PlayerInfo[playerid][jobskill] = strval(savingstring);
//=====================================================================================
/* mysql_fetch_field_row(savingstring, "pbkills");
PlayerInfo[playerid][pbkills] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "pbdeaths");
PlayerInfo[playerid][pbdeaths] = strval(savingstring);*/
//=====================================================================================
mysql_fetch_field_row(savingstring, "totalpayt");
PlayerInfo[playerid][totalpayt] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "housenum");
PlayerInfo[playerid][housenum] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "loan");
PlayerInfo[playerid][loan] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "drugs");
PlayerInfo[playerid][drugs] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "guns");
PlayerInfo[playerid][guns] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "sguns");
PlayerInfo[playerid][sguns] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "sdrugs");
PlayerInfo[playerid][sdrugs] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "power");
PlayerInfo[playerid][power] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "spawnX");
PlayerInfo[playerid][spawnX] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "spawnY");
PlayerInfo[playerid][spawnY] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "spawnZ");
PlayerInfo[playerid][spawnZ] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "spawnInter");
PlayerInfo[playerid][spawnInter] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "head");
PlayerInfo[playerid][head] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "headby");
strmid(PlayerInfo[playerid][headby], savingstring, 0, strlen(savingstring), 50);
//=====================================================================================
mysql_fetch_field_row(savingstring, "female");
PlayerInfo[playerid][female] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "bail");
PlayerInfo[playerid][bail] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "premium");
PlayerInfo[playerid][premium] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "gotphone");
PlayerInfo[playerid][gotphone] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "phonenumber");
PlayerInfo[playerid][phonenumber] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "phonebook");
PlayerInfo[playerid][phonebook] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "laptop");
PlayerInfo[playerid][laptop] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "age");
PlayerInfo[playerid][age] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "premiumexpire");
PlayerInfo[playerid][premiumexpire] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "playerteam");
PlayerInfo[playerid][playerteam] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "radio");
PlayerInfo[playerid][radio] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "freq1");
PlayerInfo[playerid][freq1] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "freq2");
PlayerInfo[playerid][freq2] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "freq3");
PlayerInfo[playerid][freq3] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "tutorial");
PlayerInfo[playerid][tutorial] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "tbanned");
PlayerInfo[playerid][tbanned] = strval(savingstring);
//==============================================================================
mysql_fetch_field_row(savingstring, "city");
strmid(PlayerInfo[playerid][city], savingstring, 0, strlen(savingstring), 50);
//==============================================================================
mysql_fetch_field_row(savingstring, "PTeamName");
strmid(PlayerInfo[playerid][PTeamName], savingstring, 0, strlen(savingstring), 50);
//==============================================================================
mysql_fetch_field_row(savingstring, "job");
strmid(PlayerInfo[playerid][job], savingstring, 0, strlen(savingstring), 50);
//==============================================================================
mysql_fetch_field_row(savingstring, "totalruns");
PlayerInfo[playerid][totalruns] = strval(savingstring);
//==============================================================================
mysql_fetch_field_row(savingstring, "Fpay");
PlayerInfo[playerid][Fpay] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "warns");
PlayerInfo[playerid][warns] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "helper");
PlayerInfo[playerid][helper] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "curfreq");
PlayerInfo[playerid][curfreq] = strval(savingstring);
//=====================================================================================
mysql_fetch_field_row(savingstring, "rankname");
strmid(PlayerInfo[playerid][rankname], savingstring, 0, strlen(savingstring), 50);
//=====================================================================================
mysql_fetch_field_row(savingstring, "phonechanges");
PlayerInfo[playerid][phonechanges] = strval(savingstring);
//=====================================================================================
// mysql_fetch_field_row(savingstring, "iPod");
// PlayerInfo[playerid][iPod] = strval(savingstring);
}
mysql_free_result();
if (PLAYERLIST_authed[playerid])
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Already authed.");
return 1;
}
PlayerTemp[playerid][totallogin]++;
SetPlayerColor(playerid, COLOR_WHITE);
PlayerTemp[playerid][isdropping] = 0;
if(PlayerInfo[playerid][playerteam]!=CIV) SetPlayerTeamEx(playerid,PlayerInfo[playerid][playerteam]);
PlayerTemp[playerid][playerTeam]=GetPlayerTeam(playerid);
new string[ 168 ];
format(string, sizeof(string), "# [%s] %s %s has logged in!", PlayerInfo[playerid][PTeamName],PlayerInfo[playerid][rankname], RPName(playerid));
if(PlayerInfo[playerid][playerteam] != CIV)
{
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],string,COLOR_PLAYER_VLIGHTBLUE);
SendClientMSG(playerid, COLOR_PLAYER_VLIGHTBLUE, "# [%s MOTD] %s", PlayerInfo[playerid][PTeamName], dini_Get(PlayerTeamFile(playerid), "motd"));
}
PLAYERLIST_authed[playerid]=true;
if(debuglvl>=3)
{
new dbg[MAX_STRING]; format(dbg,sizeof(dbg),"[DEBUG] %s(%d) Loading stats - DBG [%d]",PlayerName(playerid),playerid,debuglvl);
Debug(dbg);
}
if(PlayerInfo[playerid][tbanned] > now())
{
SendClientMessage(playerid,COLOR_RED,"Your account is currently banned, come back when you're unbanned!");
KickReas("ADMIN",playerid,"Account T. BANNED ");
return 1;
}
if(PlayerInfo[playerid][banned])
{
KickReas("SERVER",playerid,"Account BANNED ");
new tmp[ 64 ];
SendClientMessage(playerid, COLOR_RED, "==============================================");
SendClientMessage(playerid, COLOR_RED, " You have been banned from e-life Gaming! ");
SendClientMessage(playerid, COLOR_RED, " ");
SendClientMSG(playerid, COLOR_GREY, "Your IP: %s", PlayerInfo[playerid][IP]);
SendClientMSG(playerid, COLOR_GREY, "Reason: %s", PlayerInfo[playerid][banreason]);
SendClientMSG(playerid, COLOR_GREY, "Banned by: %s", PlayerInfo[playerid][whobannedme]);
SendClientMSG(playerid, COLOR_GREY, "Time&Date: %s", PlayerInfo[playerid][whenigotbanned]);
SendClientMessage(playerid, COLOR_RED, "==============================================");
return 1;
}
if(debuglvl>=3)
{
new dbg[MAX_STRING]; format(dbg,sizeof(dbg),"[DEBUG] %s(%d) Succesfully logged in - DBG [%d]",PlayerName(playerid),playerid,debuglvl);
Debug(dbg);
}
if(PlayerInfo[playerid][premium])
{
if(gettime() > PlayerInfo[playerid][premiumexpire])
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Your premium account has expired, thank you for your donation. Sicilian Mafia Roleplay Team");
PlayerInfo[playerid][premium]=0;
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "UPDATE PlayerInfo SET premium=0 WHERE user='%s'", pname);
mysql_query(query);
}
}
if(strcmp(PlayerInfo[playerid][job],"CarJacker",true)==0)
{
PlayerTemp[playerid][DropTimer] = SetTimerEx("Dropper",180000,0,"d",playerid);
PlayerTemp[playerid][candrop] = 0;
}
if(strcmp(PlayerInfo[playerid][job],"Thief",true)==0)
{
PlayerTemp[playerid][RobTimer] = SetTimerEx("Robber",240000,0,"d",playerid);
PlayerTemp[playerid][canrob] = 0;
}
SpawnPlayer(playerid);
for(new h=0;h<sizeof(House);h++)
UpdateHouse(h);
// TextDrawHideForPlayer(playerid, TextDraw__Top1);
return 1;
}