[Ajuda] O que ta errado? Carregamento MYSQL
#3

Quote:
Originally Posted by valdirdd
Посмотреть сообщение
PHP код:
CarregarCasas()
{
    for(new 
houseidhouseid MAX_HOUSEShouseid++)
    {
        new 
query[50]; // Nгo precisa ser enorme como vocк tinha colocado; Precisa apenas caber sua query dentro dela
        
mysql_format(ConnectSQLquerysizeof(query), "SELECT * FROM houses WHERE ID = %d"houseid);
        
mysql_function_query(ConnectSQLquerytrue"Carregar_Casa","i",houseid);    
    }
}
// A forward e a public coloca no final do GM
forward Carregar_Casa(houseid);
public 
Carregar_Casa(houseid)
{
    new 
string[128];
    new 
savestr[50], rowsfields;
    
cache_get_data(rowsfields);
    if(
rows)
    {
        
cache_get_field_content(0"ID"savestr);                  HouseInfo[houseid][ID] = strval(savestr);
        
cache_get_field_content(0"InPosX"savestr);              HouseInfo[houseid][InPosX] = strval(savestr);
        
cache_get_field_content(0"InPosY"savestr);              HouseInfo[houseid][InPosY] = strval(savestr);
        
cache_get_field_content(0"InPosZ"savestr);              HouseInfo[houseid][InPosZ] = strval(savestr);
        
cache_get_field_content(0"OutPosX"savestr);             HouseInfo[houseid][OutPosX] = strval(savestr);
        
cache_get_field_content(0"OutPosY"savestr);             HouseInfo[houseid][OutPosY] = strval(savestr);
        
cache_get_field_content(0"OutPosZ"savestr);             HouseInfo[houseid][OutPosZ] = strval(savestr);
        
cache_get_field_content(0"World"savestr);               HouseInfo[houseid][World] = strval(savestr);
        
cache_get_field_content(0"Price"savestr);               HouseInfo[houseid][Price] = strval(savestr);
        
cache_get_field_content(0"Owner"savestr);               HouseInfo[houseid][Owner] = strval(savestr);
        
cache_get_field_content(0"Locked"savestr);              HouseInfo[houseid][Locked] = strval(savestr);
        
cache_get_field_content(0"Dono"savestr);                HouseInfo[houseid][Dono] = strval(savestr);
        
cache_get_field_content(0"Money"savestr);               HouseInfo[houseid][Money] = strval(savestr);
        
cache_get_field_content(0"Maconha"savestr);             HouseInfo[houseid][Maconha] = strval(savestr);
        
cache_get_field_content(0"FHQ"savestr);                 HouseInfo[houseid][FHQ] = strval(savestr);
        
cache_get_field_content(0"Interior"savestr);            HouseInfo[houseid][Interior] = strval(savestr);
    }
    
    new 
casaavenda;
    if(
HouseInfo[houseid][Owner] == 1) {
        
casaavenda 1272// azul =  tem dono
    
}
    else if(
HouseInfo[houseid][Owner] == 0) {
        
casaavenda 1273// verde =  a venda
    
}
        
    new 
classhouse[30];
    if(
HouseInfo[houseid][Interior] == 1) { classhouse "Small House"; } // pequena
    
else if(HouseInfo[houseid][Interior] == 8) { classhouse "Average House"; } // media
    
else if(HouseInfo[houseid][Interior] == 2) { classhouse "Big House"; } // grande
    
else if(HouseInfo[houseid][Interior] == 6) { classhouse "Mansion"; } // mansгo
    
else if(HouseInfo[houseid][Interior] == 5) { classhouse "VIP"; }
    else { 
classhouse "BUG"; }
        
    new 
door[30];
    if(
HouseInfo[houseid][Locked] == 1) { door "{ff0000}Locked"; }
    else if(
HouseInfo[houseid][Locked] == 0) { door "Open"; }
    else { 
door "BUG"; }
        
    
//new Pickup:casas[MAX_HOUSES];
    //new Text3D:casas[MAX_HOUSES];
    //DestroyPickup(Pickupcasas[houseid]);
    //Delete3DTextLabel(Text3Dcasas[houseid]);
        
    
if(HouseInfo[houseid][Owner] == 0) {
        if(
HouseInfo[houseid][Price] <= 10000) {
            
format(stringsizeof(string), "House ID: %i\n{00ff00}For Sale!\n{FFFFFF}Class:%s\nValue:%iDPs\nDoor:%s",  HouseInfo[houseid][ID],  classhouseHouseInfo[houseid][Price], door );
            
Text3Dcasas[houseid] = Create3DTextLabel(string0xABDEACFFHouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], 10.000);
        }
        if(
HouseInfo[houseid][Price] > 10000) {
            
format(stringsizeof(string), "House ID: %i\n{00ff00}For Sale!\n{FFFFFF}Class:%s\nValue:%i$\nDoor:%s",  HouseInfo[houseid][ID],  classhouseHouseInfo[houseid][Price], door );
            
Text3Dcasas[houseid] = Create3DTextLabel(string0xABDEACFFHouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], 10.000);
        }
        
Pickupcasas[houseid] = CreatePickup(casaavenda2HouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], -1);
    }
    else if(
HouseInfo[houseid][Owner] == 1) {
        if(
HouseInfo[houseid][FHQ] == 1) {
                new 
localFHQ HouseInfo[houseid][FHQ];
                
format(stringsizeof(string), "Faction HQ\n id:%i %s"HouseInfo[houseid][FHQ], FactionInfo[localFHQ][facname] );
                
Text3Dcasas[houseid] = Create3DTextLabel(string0xABDEACFFHouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], 10.000);
                
Pickupcasas[houseid] = CreatePickup(12542HouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], -1);
        }
        else {
            
Pickupcasas[houseid] = CreatePickup(casaavenda2HouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], -1);
            if(
HouseInfo[houseid][Price] <= 10000) {
                
format(stringsizeof(string), "House ID: %i\nOwner:%s\nClass:%s\nValue:%iDPs\nDoor:%s"HouseInfo[houseid][ID],  HouseInfo[houseid][Dono], classhouseHouseInfo[houseid][Price], door );
                
Text3Dcasas[houseid] = Create3DTextLabel(string0xABDEACFFHouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], 10.000);
            }
            if(
HouseInfo[houseid][Price] > 10000) {
                
format(stringsizeof(string), "House ID: %i\nOwner:%s\nClass:%s\nValue:%i$\nDoor:%s"HouseInfo[houseid][ID], HouseInfo[houseid][Dono], classhouseHouseInfo[houseid][Price], door );
                
Text3Dcasas[houseid] = Create3DTextLabel(string0xABDEACFFHouseInfo[houseid][OutPosX], HouseInfo[houseid][OutPosY], HouseInfo[houseid][OutPosZ], 10.000);
            }
        }
    }

Agora o fato do seu ter funcionado й porque vocк nгo estб usando corretamente o mysq_query
https://sampwiki.blast.hk/wiki/MySQL#mysql_query
Dб uma olhada
Bom mas isso tambйm vai depender do plugin que vocк estб usando eu coloquei seu cod com mysql_function_query porque estou acostumado a usar ela no plugin do BlueG
Se der erros poste ai por favor
pawn Код:
[01:24:59] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_format" - invalid connection handle (id: 0)
[01:24:59] [ERROR] "mysql_tquery" - invalid connection handle (id: 0)
Esses erros, mas aн, pq vc separou a stock com outra public?
Fez algo mais?
Reply


Messages In This Thread
O que ta errado? Carregamento MYSQL - by maikons - 08.01.2015, 22:17
Re: O que ta errado? Carregamento MYSQL - by valdirdd - 08.01.2015, 23:49
Re: O que ta errado? Carregamento MYSQL - by maikons - 09.01.2015, 02:43
Re: O que ta errado? Carregamento MYSQL - by valdirdd - 09.01.2015, 10:26
Re: O que ta errado? Carregamento MYSQL - by maikons - 09.01.2015, 23:00

Forum Jump:


Users browsing this thread: 1 Guest(s)