[Ajuda] Nгo carrega
#1

Carrega apenas o id 1 na tabela.

PHP Code:
    new query[200], ids;
    
mysql_format(IDConexao, query, sizeof(query), "SELECT * FROM `Label` WHERE `ID` = '%d'", ids);
    
mysql_tquery(IDConexao, "SELECT * FROM Label", "CarregarLabel", "", ids); 
Reply
#2

Passe a funзгo CarregarLabel.
Reply
#3

PHP Code:
forward CarregarLabel(playerid);
public 
CarregarLabel(playerid)
{
    if(
cache_get_row_count())
    {
        
cache_get_field_content(0, "Texto", LabelInfo[playerid][TextoLabel], .max_len = MAX_LABEL_TEXT);
        
LabelInfo[playerid][LabelX] = cache_get_field_content_float(0, "LabelX");
        
LabelInfo[playerid][LabelY] = cache_get_field_content_float(0, "LabelY");
        
LabelInfo[playerid][LabelZ] = cache_get_field_content_float(0, "LabelZ");

        
Create3DTextLabel(LabelInfo[playerid][TextoLabel], -1, LabelInfo[playerid][LabelX], LabelInfo[playerid][LabelY], LabelInfo[playerid][LabelZ], 40.0, 0, 0);
    }
} 
Reply
#4

Qual versгo do plugin MySQL estб utilizando?
Reply
#5

r39-6
Reply
#6

O parвmetro playerid na funзгo significa o ID da label ou do jogador? Essa funзгo й para carregar todos os resultados da tabela?
Reply
#7

ID do label, siim para carregar todos os dados presentes na tabela.
Reply
#8

Tente:
PHP Code:
mysql_tquery(IDConexao, "SELECT * FROM Label", "CarregarLabel", ""); 
PHP Code:
forward CarregarLabel();
public 
CarregarLabel()
{
    new 
rows = cache_get_row_count();
    if(
rows > 0)
    {
        for(new 
i = 0; i < rows; i++)
        {
            
cache_get_field_content(i, "Texto", LabelInfo[i][TextoLabel], .max_len = MAX_LABEL_TEXT);
            
LabelInfo[i][LabelX] = cache_get_field_content_float(i, "LabelX");
            
LabelInfo[i][LabelY] = cache_get_field_content_float(i, "LabelY");
            
LabelInfo[i][LabelZ] = cache_get_field_content_float(i, "LabelZ");
            
Create3DTextLabel(LabelInfo[i][TextoLabel], -1, LabelInfo[i][LabelX], LabelInfo[i][LabelY], LabelInfo[i][LabelZ], 40.0, 0, 0);
        }
    }
    return 
1;
} 
Reply
#9

Deu certinho, vlw ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)