Loading team color - MySQL - Not returning
#1

Hey all,


I am trying to load a color code from MySQL to use for SetPlayerColor.

I have confirmed that the color saves and loads:

Код:
[07:27:19] Team Loaded:  (1) Team 1 at 0x33CCFFAA
[07:27:19] Team Loaded:  (2) Team 2 at 0xAA3333FF
[07:27:19] Team Loaded:  (3) Team 3 at 0x0000BBAA
[07:27:19] Team Loaded:  (4) Team 4 at 0xFFFF00AA
[07:27:19] Team Loaded:  (5) Team 5 at 0x33AA33AA
SetPlayerColor is setting the players color to black.

I went ahead and checked the variable later:

pawn Код:
new string[128];
        format(string,sizeof string, "%s or %d or %i",tData[1][pColor],tData[1][pColor],tData[1][pColor]);
        SendClientMessage(playerid, COLOR_WHITE, string);
and none of those return anything at all.


What should I do?


Loading the teams:

pawn Код:
stock T_Create(i)
{
    new query[420], savingstring[20];
    format(query, sizeof(query), "SELECT * FROM teams WHERE TeamID=%d",i);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "TeamID"); tData[i][TeamID] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Active"); tData[i][Active] = strval(savingstring);
        mysql_fetch_field_row(tData[i][Color],"Color");
        mysql_fetch_field_row(tData[i][pColor],"tColor");
        mysql_fetch_field_row(tData[i][Name],"Name");
        printf("Team Loaded:  (%d) %s at %s", tData[i][TeamID], tData[i][Name],tData[i][pColor]);
        tNumbers++;

    }
    mysql_free_result();

    return 1;
}
Reply
#2

Try saving the color data to a variable before saving it.
Reply
#3

I am...
Reply
#4

I cannot see you doing it for the color variables, only the teamID and active variables.
Reply
#5

Код:
mysql_fetch_field_row(tData[i][pColor],"tColor");
Reply
#6

Still need halp with this.
Reply
#7

Save it as a number, like 1,2,3,4...

Then on load check which number is and set the right color
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)