MySQL Problem (again)
#1

hi all...

i got a problem with mysql

all of the players info is loaded, but some info won't save...
strings that won't save is "pPUH" and "dunno"

thhis is my MySQL Login stock

Код:
stock MySQL_Login(playerid)
{
    new Query[800], dunno;
	format(Query, sizeof(Query), "SELECT * FROM `PlayerData` WHERE Username = '%s'", pName(playerid));
	mysql_query(Query);
	mysql_store_result();
	mysql_fetch_row_format(Query, "|");
	//sscanf(Query, "e<p<|>s[24]s[128]iiiiii",pInfo[playerid]);

    sscanf(Query, "p<|>s[24]s[128]iiiiiiiiiiiiii",
					pInfo[playerid][pUsername],
					pInfo[playerid][pPassword],
					pInfo[playerid][pLanguage],
					pInfo[playerid][pSkin],
					pInfo[playerid][pGodmode],
					AutoRepair[playerid],
					pInfo[playerid][pMoney],
					pInfo[playerid][pAdminLevel],
					pInfo[playerid][pVipLevel],
					pInfo[playerid][pHour],
					pInfo[playerid][pMin],
					pInfo[playerid][pSec],
					pInfo[playerid][pKills],
					pInfo[playerid][pDeaths],
					pInfo[playerid][pPUH],
					dunno);
    
	printf("%s",Query);
    pInfo[playerid][pLogged] = 1;
    CheckBan(playerid);
    SetPlayerSkin(playerid, pInfo[playerid][pSkin]);
    SetPlayerScore(playerid, dunno);
    playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
	new Float:kd = floatdiv(pInfo[playerid][pKills], pInfo[playerid][pDeaths]);
	new str1[300],str2[300];
	format(str1,sizeof(str1),"User Name %s\nKill Deah Ratio %0.2f (KDR)\nPlayed for %i Hours %i Mins %i Secs\nMoney %i\nAdmin Level %i\nVip Level %i\nWarnings %i\nKill %i\nDeaths %i\nPickup Found %i",
	pName(playerid),kd,pInfo[playerid][pHour],pInfo[playerid][pMin],pInfo[playerid][pSec],pInfo[playerid][pMoney],pInfo[playerid][pAdminLevel],pInfo[playerid][pVipLevel],pInfo[playerid][pWarnings],pInfo[playerid][pKills],pInfo[playerid][pDeaths],pInfo[playerid][pPUH]);
    format(str1,sizeof(str1),"Nama Pengguna %s\nKill Deah Rasio %0.2f (KDR)\nBermain selama %i Jam %i Menit %i Detik\nCash %i\nLevel Admin %i\nLevel Vip %i\nPeringatan %i\nMati %i\nMembunuh %i\nMenemukan Pickup %i",
	pName(playerid),kd,pInfo[playerid][pHour],pInfo[playerid][pMin],pInfo[playerid][pSec],pInfo[playerid][pMoney],pInfo[playerid][pAdminLevel],pInfo[playerid][pVipLevel],pInfo[playerid][pWarnings],pInfo[playerid][pKills],pInfo[playerid][pDeaths],pInfo[playerid][pPUH]);

	ShowPlayerDialogLang(playerid, DIALOG_STATISTIC, DIALOG_STYLE_MSGBOX, "Stats","Statistik", str1, str2, "Play","Main","","");
	
	PlayerLang[playerid] = pInfo[playerid][pLanguage];
	
	mysql_free_result();
	return 1;
}
P.S.: i use BlueG's MySQL R5
Reply
#2

bump!

anyone?
i need your help as soon as possible
Reply
#3

I would try to help; however I prefer to format it in a string, it is much more legible.
Reply
#4

Fixed....

thanks to nmader for the sugestion

i changed it into mysql_fetch_field_row(). It take so much time and annoying...
here is the new script

Код:
stock MySQL_Login(playerid)
{
    new Query[800],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[128]",
						pInfo[playerid][pUsername],
						pInfo[playerid][pPassword]);
						
		mysql_fetch_field_row(savestr, "pLanguage");	pInfo[playerid][pLanguage] = strval(savestr);
		mysql_fetch_field_row(savestr, "pSkin");    	pInfo[playerid][pSkin] = strval(savestr);
		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, "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]);
		
	    pInfo[playerid][pLogged] = 1;
	    CheckBan(playerid);
	    SetPlayerSkin(playerid, pInfo[playerid][pSkin]);
	    playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
		new Float:kd = floatdiv(pInfo[playerid][pKills], pInfo[playerid][pDeaths]);
		new str1[300],str2[300];
		format(str1,sizeof(str1),"User Name %s\nKill Deah Ratio %0.2f (KDR)\nPlayed for %i Hours %i Mins %i Secs\nMoney %i\nAdmin Level %i\nVip Level %i\nWarnings %i\nKill %i\nDeaths %i\nPickup Found %i",
		pName(playerid),kd,pInfo[playerid][pHour],pInfo[playerid][pMin],pInfo[playerid][pSec],pInfo[playerid][pMoney],pInfo[playerid][pAdminLevel],pInfo[playerid][pVipLevel],pInfo[playerid][pWarnings],pInfo[playerid][pKills],pInfo[playerid][pDeaths],pInfo[playerid][pPUH]);
	    format(str1,sizeof(str1),"Nama Pengguna %s\nKill Deah Rasio %0.2f (KDR)\nBermain selama %i Jam %i Menit %i Detik\nCash %i\nLevel Admin %i\nLevel Vip %i\nPeringatan %i\nMati %i\nMembunuh %i\nMenemukan Pickup %i",
		pName(playerid),kd,pInfo[playerid][pHour],pInfo[playerid][pMin],pInfo[playerid][pSec],pInfo[playerid][pMoney],pInfo[playerid][pAdminLevel],pInfo[playerid][pVipLevel],pInfo[playerid][pWarnings],pInfo[playerid][pKills],pInfo[playerid][pDeaths],pInfo[playerid][pPUH]);

        PlayerLang[playerid] = pInfo[playerid][pLanguage];
        
		ShowPlayerDialogLang(playerid, DIALOG_STATISTIC, DIALOG_STYLE_MSGBOX, "Stats","Statistik", str1, str2, "Play","Main","","");
  	}
	mysql_free_result();
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)