labels doesnt load
#3

Quote:
Originally Posted by Unrea1
View Post
This will work in MySQL plugin R41-4, also you need the library strlib for the function strcpy.

strlib.inc https://sampforum.blast.hk/showthread.php?tid=362764

So, in OnGameModeInit:

Code:
mysql_tquery(MySQL, "SELECT * FROM labels", "LoadLabels");
And the function LoadLabels more optimized.

Code:
forward LoadLabels();
public LoadLabels()
{
	new rows;

    cache_get_row_count(rows);

    if (!rows) 
    	return print("None label loaded.");

    for (new row = 0; row != rows; ++row)
    {
        new color[64], text[200];
        cache_get_value(row, "Color", color, 128);
        cache_get_value(row, "Text", text, 256);
        cache_get_value_float(row, "X", LInfo[row][POSX]);
        cache_get_value_float(row, "Y", LInfo[row][POSY]);
        cache_get_value_float(row, "Z", LInfo[row][POSZ]);
        cache_get_value_float(row, "LDistance", LInfo[row][LDistance]);
        cache_get_value_int(row, "World", LInfo[row][World]);

        strcpy(LInfo[row][Text], text);

        if(strcmp(color,"Red") == 0)
        {
            LInfo[row][Color] = llred;
            LabelID[row] = Create3DTextLabel(LInfo[row][Text],LInfo[row][Color],LInfo[row][POSX],LInfo[row][POSY],LInfo[row][POSZ],LInfo[row][LDistance],LInfo[row][World],DEFAULT_LABEL_VIEW_THREW_OBJECTS);
        }
        if(strcmp(color,"Green") == 0)
        {
            LInfo[row][Color] = llgreen;
            LabelID[row] = Create3DTextLabel(LInfo[row][Text],LInfo[row][Color],LInfo[row][POSX],LInfo[row][POSY],LInfo[row][POSZ],LInfo[row][LDistance],LInfo[row][World],DEFAULT_LABEL_VIEW_THREW_OBJECTS);
        }
        if(strcmp(color,"Yellow") == 0)
        {
            LInfo[row][Color] = llyellow;
            LabelID[row] = Create3DTextLabel(LInfo[row][Text],LInfo[row][Color],LInfo[row][POSX],LInfo[row][POSY],LInfo[row][POSZ],LInfo[row][LDistance],LInfo[row][World],DEFAULT_LABEL_VIEW_THREW_OBJECTS);
        }
        if(strcmp(color,"Blue") == 0)
        {
            LInfo[row][Color] = llblue;
            LabelID[row] = Create3DTextLabel(LInfo[row][Text],LInfo[row][Color],LInfo[row][POSX],LInfo[row][POSY],LInfo[row][POSZ],LInfo[row][LDistance],LInfo[row][World],DEFAULT_LABEL_VIEW_THREW_OBJECTS);
        }
        if(strcmp(color,"Pink") == 0)
        {
            LInfo[row][Color] = llpink;
            LabelID[row] = Create3DTextLabel(LInfo[row][Text],LInfo[row][Color],LInfo[row][POSX],LInfo[row][POSY],LInfo[row][POSZ],LInfo[row][LDistance],LInfo[row][World],DEFAULT_LABEL_VIEW_THREW_OBJECTS);
        }
        if(strcmp(color,"White") == 0)
        {
            LInfo[row][Color] = llwhite;
            LabelID[row] = Create3DTextLabel(LInfo[row][Text],LInfo[row][Color],LInfo[row][POSX],LInfo[row][POSY],LInfo[row][POSZ],LInfo[row][LDistance],LInfo[row][World],DEFAULT_LABEL_VIEW_THREW_OBJECTS);
        }
        Labelcount++;
    }
    printf("Labels loaded: %i/%i", rows, Labelcount);
    return 1;
}
Oh, i'm using R39-5, what should i do with that? Sorry, but it'll take too much time if i should update the whole gamemode to R41
Reply


Messages In This Thread
labels doesnt load - by Filbert - 23.05.2020, 03:24
Re: labels doesnt load - by Unrea1 - 23.05.2020, 03:48
Re: labels doesnt load - by Filbert - 23.05.2020, 04:17
Re: labels doesnt load - by Shadow0707 - 23.05.2020, 05:14
Re: labels doesnt load - by Filbert - 23.05.2020, 06:26
Re: labels doesnt load - by Unrea1 - 25.05.2020, 02:57
Re: labels doesnt load - by StevenLV - 25.05.2020, 04:47

Forum Jump:


Users browsing this thread: 1 Guest(s)