SetPlayerColor
#1

Hello!

I have problem with SetPlayerColor.

So first if player disconnect from the server it save's his color in mysql database.
Then if he connect's to the server it will load his color.
And if player spawn's then set's player color to his color.

Code:
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerColor(playerid, PlayerInfo[playerid][pColor]);
    print(PlayerInfo[playerid][pColor]);
    return 1;
}
It print:
0x0073E6FF

But my color in-game is black.

I don't know if im noob or what is the problem?
Reply
#2

Quote:
Originally Posted by finelaq
Посмотреть сообщение
Hello!

I have problem with SetPlayerColor.

So first if player disconnect from the server it save's his color in mysql database.
Then if he connect's to the server it will load his color.
And if player spawn's then set's player color to his color.

Code:
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerColor(playerid, PlayerInfo[playerid][pColor]);
    print(PlayerInfo[playerid][pColor]);
    return 1;
}
It print:
0x0073E6FF

But my color in-game is black.

I don't know if im noob or what is the problem?
what COLOR you exactly want to be set?
Reply
#3

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
what COLOR you exactly want to be set?
I have dialog where player can select his color.
Reply
#4

Try this:

i haven't tested it btw
PHP код:
public OnPlayerSpawn(playerid)
{
    new 
PColor PlayerInfo[playerid][pColor];
    
SetPlayerColor(playeridPColor);
    print(
PColor);
    return 
1;

Reply
#5

Can you show how the color is loaded?
Reply
#6

Quote:
Originally Posted by Andre02
Посмотреть сообщение
Try this:

i haven't tested it btw
PHP код:
public OnPlayerSpawn(playerid)
{
    new 
PColor PlayerInfo[playerid][pColor];
    
SetPlayerColor(playeridPColor);
    print(
PColor);
    return 
1;

Not working.


Quote:
Originally Posted by Macronix
Посмотреть сообщение
Can you show how the color is loaded?
pawn Код:
public Login(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    if (rows)
    {
                // other stuff
        cache_get_field_content(0, "Color", PlayerInfo[playerid][Color], db, 15);
        }
        else
        {
                // other stuff
        }


}
Reply
#7

Wait, you use "pColor" to set the color of the player but you load the color into "Color" array?

Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerColor(playerid, PlayerInfo[playerid][pColor]);
	print(PlayerInfo[playerid][pColor]);
	return 1;
}
Код:
public Login(playerid)
{
	new rows, fields;
	cache_get_data(rows, fields);
	if (rows)
	{
                // other stuff
		cache_get_field_content(0, "Color", PlayerInfo[playerid][Color], db, 15);
        }
        else
        {
                // other stuff
        }


}
Reply
#8

Quote:
Originally Posted by Macronix
Посмотреть сообщение
Wait, you use "pColor" to set the color of the player but you load the color into "Color" array?

Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerColor(playerid, PlayerInfo[playerid][pColor]);
	print(PlayerInfo[playerid][pColor]);
	return 1;
}
Код:
public Login(playerid)
{
	new rows, fields;
	cache_get_data(rows, fields);
	if (rows)
	{
                // other stuff
		cache_get_field_content(0, "Color", PlayerInfo[playerid][Color], db, 15);
        }
        else
        {
                // other stuff
        }


}
Hmm.. But that doesn't solve my problem.
Reply
#9

Just replace the "Color" with "pColor" ?

Or you could try it like that since it is an integer value:

Код:
PlayerInfo[playerid][pColor] = cache_get_field_content_int(0, "Color", db);
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)