Код:
stock MySQL_Login(playerid)
{
new Query[512]/*,savestr[50]*/;
format(Query, sizeof(Query), "SELECT * FROM `PlayerData` WHERE Username = '%s'", pName(playerid));
mysql_query(Query);
mysql_store_result();
while(mysql_fetch_row_format(Query, "|"))
{
//sscanf(Query, "e<p<|>s[24]s[128]iiiiii",pInfo[playerid]);
sscanf(Query, "p<|>s[24]s[64]s[16]iiiiiiiiiiiiiiis[16]is[24]is[24]iffffiiii",
pInfo[playerid][pUsername],
pInfo[playerid][pPassword],
pInfo[playerid][pIP],
pInfo[playerid][pLanguage],
pInfo[playerid][pMoney],
pInfo[playerid][pAdminLevel],
pInfo[playerid][pVipLevel],
pInfo[playerid][pWeek],
pInfo[playerid][pDay],
pInfo[playerid][pHour],
pInfo[playerid][pMin],
pInfo[playerid][pSec],
pInfo[playerid][pKills],
pInfo[playerid][pDeaths],
pInfo[playerid][pSkin],
pInfo[playerid][pGodmode],
AutoRepair[playerid],
pInfo[playerid][pUseCol],
pInfo[playerid][pColor],
pInfo[playerid][pUseTag],
pInfo[playerid][pVipTag],
pInfo[playerid][pUseTagCol],
pInfo[playerid][pVipTagCol],
pInfo[playerid][pUsePos],
pInfo[playerid][pA],
pInfo[playerid][pX],
pInfo[playerid][pY],
pInfo[playerid][pZ],
pInfo[playerid][pHasSavedPos],
pInfo[playerid][pScore],
pInfo[playerid][pPUH],
pInfo[playerid][pRacewon]);
/*mysql_fetch_field_row(savestr, "pLanguage"); pInfo[playerid][pLanguage] = strval(savestr);
mysql_fetch_field_row(savestr, "pSkin"); pInfo[playerid][pSkin] = strval(savestr); SetPlayerSkin(playerid, pInfo[playerid][pSkin]);
mysql_fetch_field_row(savestr, "pGodmode"); pInfo[playerid][pGodmode] = strval(savestr);
mysql_fetch_field_row(savestr, "pAutoR"); AutoRepair[playerid] = strval(savestr);
mysql_fetch_field_row(savestr, "pMoney"); pInfo[playerid][pMoney] = strval(savestr);
mysql_fetch_field_row(savestr, "pAdminLevel"); pInfo[playerid][pAdminLevel] = strval(savestr);
mysql_fetch_field_row(savestr, "pVipLevel"); pInfo[playerid][pVipLevel] = strval(savestr);
mysql_fetch_field_row(savestr, "pWeek"); pInfo[playerid][pWeek] = strval(savestr);
mysql_fetch_field_row(savestr, "pDay"); pInfo[playerid][pDay] = strval(savestr);
mysql_fetch_field_row(savestr, "pHour"); pInfo[playerid][pHour] = strval(savestr);
mysql_fetch_field_row(savestr, "pMin"); pInfo[playerid][pMin] = strval(savestr);
mysql_fetch_field_row(savestr, "pSec"); pInfo[playerid][pSec] = strval(savestr);
mysql_fetch_field_row(savestr, "pKills"); pInfo[playerid][pKills] = strval(savestr);
mysql_fetch_field_row(savestr, "pDeaths"); pInfo[playerid][pDeaths] = strval(savestr);
mysql_fetch_field_row(savestr, "pPUH"); pInfo[playerid][pPUH] = strval(savestr);
mysql_fetch_field_row(savestr, "pScore"); pInfo[playerid][pScore] = strval(savestr); SetPlayerScore(playerid, pInfo[playerid][pScore]);
mysql_fetch_field_row(savestr, "pRacewon"); pInfo[playerid][pRacewon] = strval(savestr);
mysql_fetch_field_row(savestr, "pUseCol"); pInfo[playerid][pUseCol] = strval(savestr);
mysql_fetch_field_row(savestr, "pColor"); strmid(pInfo[playerid][pColor],savestr, 0, strlen(savestr), 15);
mysql_fetch_field_row(savestr, "pUseTag"); pInfo[playerid][pUseTag] = strval(savestr);
mysql_fetch_field_row(savestr, "pVipTag"); format(pInfo[playerid][pVipTag], 49, savestr);
mysql_fetch_field_row(savestr, "pUseTagCol"); pInfo[playerid][pUseTagCol] = strval(savestr);
mysql_fetch_field_row(savestr, "pVipTagCol"); format(pInfo[playerid][pVipTagCol], 9, savestr);
mysql_fetch_field_row(savestr, "pUsePos"); pInfo[playerid][pUsePos] = strval(savestr);
mysql_fetch_field_row(savestr, "pA"); pInfo[playerid][pA] = strval(savestr);
mysql_fetch_field_row(savestr, "pX"); pInfo[playerid][pX] = strval(savestr);
mysql_fetch_field_row(savestr, "pY"); pInfo[playerid][pY] = strval(savestr);
mysql_fetch_field_row(savestr, "pZ"); pInfo[playerid][pZ] = strval(savestr);
mysql_fetch_field_row(savestr, "pHasSavedPos"); pInfo[playerid][pHasSavedPos] = strval(savestr);*/
SetPlayerSkin(playerid, pInfo[playerid][pSkin]);
SetPlayerScore(playerid, pInfo[playerid][pScore]);
pInfo[playerid][pLogged] = 1;
CheckBan(playerid);
SetPlayerColor(playerid, pInfo[playerid][pColor]);
if(pInfo[playerid][pUseCol] == 0)
{
SetPlayerColor(playerid, PlayerColors[playerid]);
}
playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
PlayerLanguage(playerid, pInfo[playerid][pLanguage]);
}
mysql_free_result();
new Float:kd = floatdiv(pInfo[playerid][pKills], pInfo[playerid][pDeaths]);
new str1[300],str2[300];
format(str1,sizeof(str1),"User Name: %s\nPlayed for %i Weeks %i Days %i Hours\nMoney: %i\nAdmin Level: %i\nVip Level: %i\nWarnings: %i\nKill: %i\nDeaths: %i\nKill Deah Ratio: %0.2f (KDR)\nPickup Found: %i\n Race Won: %i",
pName(playerid),pInfo[playerid][pWeek],pInfo[playerid][pDay],pInfo[playerid][pHour],pInfo[playerid][pMoney],pInfo[playerid][pAdminLevel],pInfo[playerid][pVipLevel],pInfo[playerid][pWarnings],pInfo[playerid][pKills],pInfo[playerid][pDeaths],kd,pInfo[playerid][pPUH],pInfo[playerid][pRacewon]);
format(str2,sizeof(str2),"Nama Pengguna: %s\nBermain selama %i Minggu %i Hari %i Jam\nCash: %i\nLevel Admin: %i\nLevel Vip: %i\nPeringatan: %i\nMembunuh: %i\nMati: %i\nKill Deah Rasio: %0.2f (KDR)\nPickup ditemukan: %i\nMenang Race: %i",
pName(playerid),pInfo[playerid][pWeek],pInfo[playerid][pDay],pInfo[playerid][pHour],pInfo[playerid][pMoney],pInfo[playerid][pAdminLevel],pInfo[playerid][pVipLevel],pInfo[playerid][pWarnings],pInfo[playerid][pKills],pInfo[playerid][pDeaths],kd,pInfo[playerid][pPUH],pInfo[playerid][pRacewon]);
ShowPlayerDialogLang(playerid, DIALOG_STATISTIC, DIALOG_STYLE_MSGBOX, "Statistic", "Statistik", str1, str2,"Close", "Tutup", "", "");
return 1;
}