SA-MP Forums Archive
Loading team color - MySQL - Not returning - 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: Loading team color - MySQL - Not returning (/showthread.php?tid=490283)



Loading team color - MySQL - Not returning - Shockey HD - 26.01.2014

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



Re: Loading team color - MySQL - Not returning - Weponz - 26.01.2014

Try saving the color data to a variable before saving it.


Re: Loading team color - MySQL - Not returning - Shockey HD - 26.01.2014

I am...


Re: Loading team color - MySQL - Not returning - Weponz - 26.01.2014

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


Re: Loading team color - MySQL - Not returning - Shockey HD - 26.01.2014

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



Re: Loading team color - MySQL - Not returning - Shockey HD - 27.01.2014

Still need halp with this.


Re: Loading team color - MySQL - Not returning - StreetGT - 27.01.2014

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

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