Color wont change
#1

hi i got once more problem(i've already got this problem for a long time)
player's color wont change when they login, his color turn into black...

can anyone help me?

the set player's color
Код:
SetPlayerColor(playerid, pInfo[playerid][pColor]);
on mysql_log.txt
Код:
CMySQLHandler::FetchRow() - Return: playername|playerspassword|playersip|1|2530|0|0|0|0|0|3|10|0|0|283|1|0|1|0xADFF2FFF|0||0||0|0|0|0|0|0|2|0|0|57//the underlined one is the color
Reply
#2

You need to make sure that you are retrieving the Color properly.

Question: Why do you have a variable for Name colors? why not set all white when they join and then sepertly set the colors. Much more efficient then creating a variable.
Reply
#3

Where are you setting the color? show the code where you're setting the player's color.
Reply
#4

here is my code

Код:
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;
}
Reply
#5

bump
anyone?
Reply
#6

Colours are integers, not strings. Just save/load the colour as integer and it will work.
Reply
#7

is it integers?

Quote:

0xFFFFFFFF

Reply
#8

Hexadecimal numbers are integers. But you use it like it's string when you don't have to.
pawn Код:
// wrong
strmid(pInfo[playerid][pColor],savestr, 0, strlen(savestr), 15);
Reply
#9

i've already commented these line

Quote:

/*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);*/

any other suggestion?

EDIT:

i've already change the code into
pawn Код:
sscanf(Query, "p<|>s[24]s[64]s[16]iiiiiiiiiiiiiiiiis[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]);
how it's look before:
pawn Код:
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]);
and tried to change the pColor inside of phpMyAdmin too. but it still not working
Reply
#10

BUMP

the only one thing that bugged is SetPlayerColor, i got SetPlayerMarkerForPlayer and it's just fine...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)