SetPlayerColor - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetPlayerColor (
/showthread.php?tid=585620)
SetPlayerColor -
finelaq - 15.08.2015
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?
Re: SetPlayerColor -
Crystallize - 15.08.2015
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?
Re: SetPlayerColor -
finelaq - 15.08.2015
Quote:
Originally Posted by Wizzard2H
what COLOR you exactly want to be set?
|
I have dialog where player can select his color.
Re: SetPlayerColor -
Andre02 - 15.08.2015
Try this:
i haven't tested it btw
PHP код:
public OnPlayerSpawn(playerid)
{
new PColor = PlayerInfo[playerid][pColor];
SetPlayerColor(playerid, PColor);
print(PColor);
return 1;
}
AW: SetPlayerColor -
Macronix - 15.08.2015
Can you show how the color is loaded?
Re: AW: SetPlayerColor -
finelaq - 15.08.2015
Quote:
Originally Posted by Andre02
Try this:
i haven't tested it btw
PHP код:
public OnPlayerSpawn(playerid)
{
new PColor = PlayerInfo[playerid][pColor];
SetPlayerColor(playerid, PColor);
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
}
}
AW: SetPlayerColor -
Macronix - 15.08.2015
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
}
}
Re: AW: SetPlayerColor -
finelaq - 16.08.2015
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.
AW: SetPlayerColor -
Macronix - 16.08.2015
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);