3dTextLabel not loading right
#1

Here is a photo of the 3dTextLabel in game: http://imgur.com/a/mqGTL (Left desktop, too lazy to cut off the photo)

As you can see, Everything is loading right expect the owner name


Here is the code:

PHP код:
LoadBuildings()
{
    new 
DB_Query[256], string[120];
    for(new 
0MAX_BUILDINGSi++)
    {
        
mysql_format(DatabaseDB_Querysizeof(DB_Query), "SELECT * FROM `Buildings` WHERE `ID` = %d"i);
         
mysql_query(DatabaseDB_Query);
        
cache_get_value_int(0"ID"BuildingInfo[i][ID]);
        
cache_get_value(0"Owner"BuildingInfo[i][bOwner], 24);
        
cache_get_value(0"Name"BuildingInfo[i][bName], 120);
        
cache_get_value_int(0"VirtualWorld"BuildingInfo[i][bVW]);
        
cache_get_value_int(0"Pickup"BuildingInfo[i][bPickup]);
        
cache_get_value_int(0"InteriorID"BuildingInfo[i][bInt]);
        
        
cache_get_value_float(0"EntranceX"BuildingInfo[i][bEntranceX]);
        
cache_get_value_float(0"EntranceY"BuildingInfo[i][bEntranceY]);
        
cache_get_value_float(0"EntranceZ"BuildingInfo[i][bEntranceZ]);
        
        
cache_get_value_float(0"ExitX"BuildingInfo[i][bExitX]);
        
cache_get_value_float(0"ExitY"BuildingInfo[i][bExitY]);
        
cache_get_value_float(0"ExitZ"BuildingInfo[i][bExitZ]);
        
        
buildings[BuildingInfo[i][ID]] = CreatePickup(BuildingInfo[i][bPickup], 1BuildingInfo[i][bEntranceX], BuildingInfo[i][bEntranceY], BuildingInfo[i][bEntranceZ], 0);
        
format(stringsizeof(string), ""COL_LIGHTBLUE"%s\n"COL_WHITE"-----\n"COL_LIGHTBLUE"Owned by: "COL_WHITE"%s"BuildingInfo[i][bName], BuildingInfo[i][bOwner]);
        
buildings3d[BuildingInfo[i][ID]] = Create3DTextLabel(stringCOLOR_WHITEBuildingInfo[i][bEntranceX], BuildingInfo[i][bEntranceY], BuildingInfo[i][bEntranceZ], 15.000);
        
    }
    return 
1;

Reply
#2

((Please PM your mods xD.... Especially the HUD + Map please...))
Reply
#3

This is a horrible way to load multiple rows. Instead of sending 100 queries and retrieving one result at a time, send one query and retrieve all results simultaneously. Also you are not freeing the result here which leads to memory leaks.

PHP код:
LoadBuildings()
{
    
mysql_tquery(Database"SELECT * FROM Buildings LIMIT" #MAX_BUILDINGS, "OnBuildingsAvailable");
}

public 
OnBuildingsAvailable()
{
    new 
rows;
    
cache_get_row_count(rows);
    
    for(new 
irowsi++)
    {
        
cache_get_value_int(i"ID"BuildingInfo[i][ID]); 
        
        
// etc
    
}

Screenshot is too small to make out anything meaningful. It's probably related to charsets. Are you using any special non-Latin characters?
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
This is a horrible way to load multiple rows. Instead of sending 100 queries and retrieving one result at a time, send one query and retrieve all results simultaneously. Also you are not freeing the result here which leads to memory leaks.

PHP код:
LoadBuildings()
{
    
mysql_tquery(Database"SELECT * FROM Buildings LIMIT" #MAX_BUILDINGS, "OnBuildingsAvailable");
}
public 
OnBuildingsAvailable()
{
    new 
rows;
    
cache_get_row_count(rows);
    
    for(new 
irowsi++)
    {
        
cache_get_value_int(i"ID"BuildingInfo[i][ID]); 
        
        
// etc
    
}

Screenshot is too small to make out anything meaningful. It's probably related to charsets. Are you using any special non-Latin characters?
Nope, at the owner row in database it is 'Noone' the default one, also can you show me how to free the result too? or which function is used to free the result


#EDIT
Here is a better photo: http://imgur.com/a/dN8Yd

#EDIT 2, Fixed, it was due to the low string.. still not sure why as the name wasn't going over the string but idk

I still want to know how to free the result because I dont find anything regarding that in the r40 mysql wiki, I use mysql r41-2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)