Loading color from SQL, Showing as black in game
#1

Im trying to load a SetPlayerColor, Color from SQL.


Everytime it loads, it comes out black.


pawn Код:
new string[128];
                    format(string, sizeof(string), "TEAM COLOR CHANGED TO %s",tData[1][tColor]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    SetPlayerColor(playerid, tData[1][tColor]);
Loading color

pawn Код:
mysql_fetch_field_row(tData[i][tColor],"tColor");

and it loads perfectly fine in the console


Код:
[01:14:36] Team Loaded:  (1) Los Santos Militia - 0x2E8B57AA
[01:14:36] Team Loaded:  (2) Los Santos Police Department - 0x0000BBAA
[01:14:36] Team Loaded:  (3) Bad Boys Society - 0x9370DBFF
[01:14:36] Team Loaded:  (4) Market Bloc'C Crips - 0x4682B4FF
[01:14:36] Team Loaded:  (5) Los Santos Vagos - 0xFFFF00FF
Reply
#2

You're using the "%s" specifier and mysql_fetch_field_row... that means you are storing these colors as strings? You should store them as integers instead (because that's what they are, and that's what SetPlayerColor wants). I don't know why you are even displaying the hex information in the messages either, tbh; you should just display "Team Loaded: (1) Los Santos Militia" in the corresponding color :P.
Reply
#3

Those Team Loaded messages are from Console.


And I did this -

pawn Код:
mysql_fetch_field_row(savingstring,"tColor"); tData[i][tColor] = strval(savingstring);
Removing it from being a string variable, now colors wont even load in console.
Reply
#4

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
Those Team Loaded messages are from Console.


And I did this -

pawn Код:
mysql_fetch_field_row(savingstring,"tColor"); tData[i][tColor] = strval(savingstring);
Removing it from being a string variable, now colors wont even load in console.
Did you update the DB, so that the colors are stored as integers too? If not, strval would likely just return 0, and that might be your issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)