SA-MP Forums Archive
Dynamic textdraw dont load - 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: Dynamic textdraw dont load (/showthread.php?tid=530853)



Dynamic textdraw dont load - BizzyD - 09.08.2014

Hello, got a problem with my dynamic textdraws not loading.
I am using BlueG r33 and they dont show up. they are in the database but dont show up.
No errors in mysql.log either.

This is the loading codes:

Код:
stock LoadTextLabels()
{
    for(new i,j = MAX_TEXT; i != j; i++)
    {
            mysql_query(conn,"SELECT * FROM textlabel");
			cache_get_field_content(0,"t_text",tInfo[i][t_string],conn);
            cache_get_field_content(0,"t_color_",tInfo[i][t_color],conn);
            tInfo[i][t_postion][0] = cache_get_field_content_float(0,"t_x",conn);
            tInfo[i][t_postion][1] = cache_get_field_content_float(0,"t_y",conn);
            tInfo[i][t_postion][2] = cache_get_field_content_float(0,"t_z",conn);
            tInfo[i][t_id] = cache_get_field_content_int(0,"t_id_",conn);
    }
    SetTimer("_loadTextAllTextLabel",2000,false);
    return 1;
}

forward _loadTextAllTextLabel();
public _loadTextAllTextLabel()
{
        for(new i,j = MAX_TEXT; i != j; i++)
        {
        	tInfo[i][t_label] = Create3DTextLabel(tInfo[i][t_string],0xED1414FF,tInfo[i][t_postion][0],tInfo[i][t_postion][1],tInfo[i][t_postion][2],40.0,0,0);
                
        }
        return 1;
}
Database:

Quote:

mysql_query(conn,"CREATE TABLE IF NOT EXISTS textlabel(t_id_ INT(20),t_text VARCHAR(22,t_color_ VARCHAR(23),t_x float(20),t_y float(20),t_z float(20))");

Whats wrong?


Re: Dynamic textdraw dont load - BizzyD - 09.08.2014

dynamic 3dtextlabels *


Re: Dynamic textdraw dont load - BizzyD - 09.08.2014

Forgot to add the command:

Код:
CMD:maketext(playerid,params[])
{
    if(sscanf(params,"s[128]",params[0]))
    return SendClientMessage(playerid,-1,"[Usage]: /maketext [Text-string]");
    new gQuery[356], Float: gPos[MAX_PLAYERS][3];
	tInfo[playerid][t_id] ++;
    GetPlayerPos(playerid,gPos[playerid][0],gPos[playerid][1],gPos[playerid][2]);
	format(gQuery, sizeof(gQuery), "INSERT INTO textlabel(`t_id_`,`t_text`,`t_color_`,`t_x`,`t_y`,`t_z`) VALUES ('%d', '%s', '%s', '%f', '%f', '%f')", tInfo[playerid][t_id],params[0],"red",gPos[playerid][0],gPos[playerid][1],gPos[playerid][2]);
	mysql_function_query(conn, gQuery, false, "", "");
	for(new i,j = MAX_TEXT; i != j; i++) tInfo[i][t_id] ++;
    tInfo[playerid][t_label] = Create3DTextLabel(params[0],0xED1414FF,gPos[playerid][0],gPos[playerid][1],gPos[playerid][2],40.0,0,0);
    SendClientMessage(playerid,-1,"[Success]: you successuflly created a textlabel!");
    return 1;
}



Respuesta: Dynamic textdraw dont load - Xabi - 09.08.2014

Try this:

pawn Код:
stock LoadTextLabels()
{
    mysql_query(conn,"SELECT * FROM textlabel", "OnLoadTextLabels", "");
    return 1;
}

forward OnLoadTextLabels();
public OnLoadTextLabels()
{
        new totalLabels = cache_get_row_count();
        for(new i,j = totalLabels ; i != j; i++)
        {
            cache_get_field_content(0,"t_text",tInfo[i][t_string],conn);
            cache_get_field_content(0,"t_color_",tInfo[i][t_color],conn);
            tInfo[i][t_postion][0] = cache_get_field_content_float(0,"t_x",conn);
            tInfo[i][t_postion][1] = cache_get_field_content_float(0,"t_y",conn);
            tInfo[i][t_postion][2] = cache_get_field_content_float(0,"t_z",conn);
            tInfo[i][t_id] = cache_get_field_content_int(0,"t_id_",conn);[B][/B]
            tInfo[i][t_label] = Create3DTextLabel(tInfo[i][t_string],0xED1414FF,tInfo[i][t_postion][0],tInfo[i][t_postion][1],tInfo[i][t_postion][2],40.0,0,0);
               
        }
        return 1;
}



Re: Dynamic textdraw dont load - BizzyD - 09.08.2014

This code:
Код:
mysql_query(conn,"SELECT * FROM textlabel", "OnLoadTextLabels", "");
Gives:
Quote:

number of arguments does not match definition




Re: Dynamic textdraw dont load - SKAzini - 09.08.2014

pawn Код:
mysql_query(conn,"SELECT * FROM textlabel");



Re: Dynamic textdraw dont load - BizzyD - 09.08.2014

Quote:
Originally Posted by SKAzini
Посмотреть сообщение
pawn Код:
mysql_query(conn,"SELECT * FROM textlabel");
Need to make it to use

Код:
forward OnLoadTextLabels();
public OnLoadTextLabels()
{
        new totalLabels = cache_get_row_count();
        for(new i,j = totalLabels ; i != j; i++)
        {
            cache_get_field_content(0,"t_text",tInfo[i][t_string],conn);
            cache_get_field_content(0,"t_color_",tInfo[i][t_color],conn);
            tInfo[i][t_postion][0] = cache_get_field_content_float(0,"t_x",conn);
            tInfo[i][t_postion][1] = cache_get_field_content_float(0,"t_y",conn);
            tInfo[i][t_postion][2] = cache_get_field_content_float(0,"t_z",conn);
            tInfo[i][t_id] = cache_get_field_content_int(0,"t_id_",conn);
            tInfo[i][t_label] = Create3DTextLabel(tInfo[i][t_string],0xED1414FF,tInfo[i][t_postion][0],tInfo[i][t_postion][1],tInfo[i][t_postion][2],40.0,0,0);
                
        }
        return 1;
}
EDIT:

Made it like this instead:

Код:
stock LoadTextLabels()
{
    mysql_query(conn,"SELECT * FROM textlabel");
    new totalLabels = cache_get_row_count();
    for(new i,j = totalLabels ; i != j; i++)
    {
        cache_get_field_content(0,"t_text",tInfo[i][t_string],conn);
        cache_get_field_content(0,"t_color_",tInfo[i][t_color],conn);
        tInfo[i][t_postion][0] = cache_get_field_content_float(0,"t_x",conn);
        tInfo[i][t_postion][1] = cache_get_field_content_float(0,"t_y",conn);
        tInfo[i][t_postion][2] = cache_get_field_content_float(0,"t_z",conn);
        tInfo[i][t_id] = cache_get_field_content_int(0,"t_id_",conn);
        tInfo[i][t_label] = Create3DTextLabel(tInfo[i][t_string],0xED1414FF,tInfo[i][t_postion][0],tInfo[i][t_postion][1],tInfo[i][t_postion][2],40.0,0,0);
        print("Loaded Labels");

    }
    return 1;
}
Still dont load though


Re: Dynamic textdraw dont load - BizzyD - 09.08.2014

anyone know?