SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerColor() (/showthread.php?tid=207993)



SetPlayerColor() - hanzen - 07.01.2011

When retrieving colors from MySQL and setting it on login how do I store it properly and call it properly?


Re: SetPlayerColor() - Toreno - 07.01.2011

Why from MySQL?
Put it in a simple Include and It'll be much easier, and what do you mean by LOGIN?


Re: SetPlayerColor() - hanzen - 07.01.2011

I'm saving the playercolors to MySQL, and no I'm not going to make any stupid include. I'm just wondering how I can set them properly without it always returning 0. If I do a printf it gives me the correct colorcode, but when SetPlayerColor() it sets 0. For some reason.


Re: SetPlayerColor() - DVDK - 07.01.2011

Show the part where it converts the MySQL var to a string.


Re: SetPlayerColor() - hanzen - 07.01.2011

I'm saving it as a string, that's probably not right?
pawn Код:
mysql_fetch_field("color", PlayerData[playerid][pColor]);



Re: SetPlayerColor() - Toreno - 07.01.2011

pawn Код:
mysql_fetch_field("color", PlayerData[playerid][pColor]);
I don't know how did you exactly saves it, with a ORIGINAL color?

EXAMPLE:

0x00D900C8


Re: SetPlayerColor() - DVDK - 07.01.2011

And how to you converted GetPlayerColor to PlayerData[playerid][pColor]?


Re: SetPlayerColor() - hanzen - 07.01.2011

Quote:
Originally Posted by DVDK
Посмотреть сообщение
And how to you converted GetPlayerColor to PlayerData[playerid][pColor]?
That's not the problem.... MySQL gives me the correct color (0x2641FEAA), and so does the printf() it's SetPlayerColor() that's the problem.


Re: SetPlayerColor() - Toreno - 07.01.2011

Try this:
pawn Код:
mysql_fetch_field("color", PlayerData[playerid][pColor]);
pawn Код:
SetPlayerColor(playerid, PlayerData[playerid][pColor]);



Re: SetPlayerColor() - hanzen - 07.01.2011

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
Try this:
pawn Код:
mysql_fetch_field("%s", PlayerData[playerid][pColor]);
pawn Код:
SetPlayerColor(playerid, PlayerData[playerid][pColor]);
Eh, do you even know how MySQL works?