public OnPlayerSpawn(playerid)
{
SetPlayerColor(playerid, PlayerInfo[playerid][pColor]);
print(PlayerInfo[playerid][pColor]);
return 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 Код:
0x0073E6FF But my color in-game is black. I don't know if im noob or what is the problem? |
public OnPlayerSpawn(playerid)
{
new PColor = PlayerInfo[playerid][pColor];
SetPlayerColor(playerid, PColor);
print(PColor);
return 1;
}
|
Try this:
i haven't tested it btw PHP код:
|
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
}
}

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
}
}
|
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
}
}
|

PlayerInfo[playerid][pColor] = cache_get_field_content_int(0, "Color", db);