Help with with multi dimensional arrays.
#1

Hello everyone!

I'm making a bridge collapse and repair system upon bombing. I have stored the coordinates and stuff in the enumerator arrays, planning to move them in the database after I successfully make it working. But my problem here right now is, the bridge has 2 objects and both has their own coordinates for fixed and damaged ones.

PHP код:
#define MAX_BRIDGES 2
enum E_BRIDGE_DATA {
    
b_ID,
    
Float:b_Fixed_X,
    
Float:b_Fixed_Y,
    
Float:b_Fixed_Z,
    
Float:b_Fixed_RX,
    
Float:b_Fixed_RY,
    
Float:b_Fixed_RZ,
    
Float:b_Damaged_X,
    
Float:b_Damaged_Y,
    
Float:b_Damaged_Z,
    
Float:b_Damaged_RX,
    
Float:b_Damaged_RY,
    
Float:b_Damaged_RZ,
    
b_Objects[2]
}
new 
g_Bridge[MAX_BRIDGES][E_BRIDGE_DATA] = {
    {
16610, -1024.410892710.7136248.40410359.985410.0, -173.35580, -1024.410892710.7136243.02410359.985415.0, -173.35580},
     {
16037, -1143.704222696.8532748.73220359.985410.0, -173.37590, -1143.704222696.8532743.45050359.98541, -5.0, -173.37590}
}; 
As you can see the single bridge has two IDs in this one.

This works when I loop through the bridge IDs and set the objects' position defined in the array like
PHP код:
for (new 0MAX_BRIDGESi++) {
    
SetDynamicObjectPos(g_Bridge[i][b_Objects][i],
        
g_Bridge[i][b_Damaged_X],
        
g_Bridge[i][b_Damaged_Y],
        
g_Bridge[i][b_Damaged_Z]);
    
SetDynamicObjectRot(g_Bridge[i][b_Objects][i],
        
g_Bridge[i][b_Damaged_RX],
        
g_Bridge[i][b_Damaged_RY],
        
g_Bridge[i][b_Damaged_RZ]);

I am trying to include both objects and their coordinates in one bridge ID so that I could just use bridge ID 0 and both the objects would change their position, but I am out of idea on how to do it.

Sorry for the poor explanation but I hope you can understand what I mean.
Reply


Messages In This Thread
Help with with multi dimensional arrays. - by Sjn - 06.10.2016, 11:09
Re: Help with with multi dimensional arrays. - by RoboN1X - 06.10.2016, 11:42
Re: Help with with multi dimensional arrays. - by Sjn - 06.10.2016, 14:40
Re: Help with with multi dimensional arrays. - by Sjn - 08.10.2016, 07:22

Forum Jump:


Users browsing this thread: 1 Guest(s)