Супер изъятие данных или двумерный запрос.
#5

Код правда на C++, но думаю будет полезен.
Сперва мы загружаем наших игроков; Потом, этим запросом загружаем их одежду

Переменные:
slot - ид дерева
fell - ид слота, в данном случае - лесопилки


PHP код:
                void loadTrees()
                {
                    
int slot 0;
                    
int fell 0;
                    
MYSQL_ROW row;
                    
//----------------------------------------------//
                    
if ( mysql_query(con"SELECT * FROM feller_trees ORDER BY owner") )
                    {
                        
logprintf("[FellerTrees] : query error: %s"mysql_error(con));
                    }
                    else
                    {
                        
MYSQL_RES *result mysql_store_result(con);
                        
//----------------------------------------------//
                        
while ( ( row mysql_fetch_row(result) ) )
                        {
                            if ( 
fell == atoi(row[1]) - && slot MAX_TREES_PER_FELLER slot++;
                            else
                            {
                                
fell atoi(row[1]) - 1;
                                
slot 0;
                            }
                            
//````````````````//
                            
Feller[fell].Trees[slot].db            atoi(row[0]);
                            
Feller[fell].Trees[slot].Type        atoi(row[2]);
                            
Feller[fell].Trees[slot].Pos.X        atof(row[3]);
                            
Feller[fell].Trees[slot].Pos.Y        atof(row[4]);
                            
Feller[fell].Trees[slot].Pos.Z        atof(row[5]);
                            
Feller[fell].Trees[slot].Health        atoi(row[6]);
                            
//````````````````//
                            
Feller[fell].Trees[slot].obj StreamerCall::Native::CreateDynamicObject
                            
(
                                
656,
                                
Feller[fell].Trees[slot].Pos.X,
                                
Feller[fell].Trees[slot].Pos.Y,
                                
Feller[fell].Trees[slot].Pos.TREE_OFFSET,
                                
0.0f0.0f0.0f00
                            
);
                            
//----------------------------------------------//
                            
StreamerCall::Native::MoveDynamicObject
                            
(
                                
Feller[fell].Trees[slot].obj,
                                
Feller[fell].Trees[slot].Pos.X,
                                
Feller[fell].Trees[slot].Pos.Y,
                                
Feller[fell].Trees[slot].Pos.ZTREE_SPEED
                            
);
                        }
                    }
                } 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)