weird problem, a variable changing itself, +REP
#1

PHP код:
new teleportfixer[MAX_TELEPORTS][TeleportInfo];
public 
LoadTeleports()
{
    for(new 
iMAX_TELEPORTSi++)
    {
        
DestroyDynamicPickup(TeleportPickup1[i]);
        
DestroyDynamicPickup(TeleportPickup2[i]);
        
DestroyDynamic3DTextLabel(TeleportText1[i]);
        
DestroyDynamic3DTextLabel(TeleportText2[i]);
        
TeleportDB[i][X1] = 0;
        
TeleportDB[i][Y1] = 0;
        
TeleportDB[i][Y1] = 0;
        
TeleportDB[i][A1] = 0;
        
TeleportDB[i][Interior1] = 0;
        
TeleportDB[i][VirtualWorld1] = 0;
        
TeleportDB[i][X2] = 0;
        
TeleportDB[i][Y2] = 0;
        
TeleportDB[i][Y2] = 0;
        
TeleportDB[i][A2] = 0;
        
TeleportDB[i][Interior2] = 0;
        
TeleportDB[i][VirtualWorld2] = 0;
        
TeleportDB[i][Price] = 0;
        
TeleportDB[i][Owner] = 0;
        
TeleportDB[i][Lock] = 0;
        for(new 
j5j++)
        {
            
TeleportDB[i][Key][j] = 0;
        }
    }
    new 
rowsfieldsgetstr[32];
    
cache_get_data(rowsfields);
    if(
rows)
    {
        for(new 
0rowsi++)
        {
            
teleportfixer[i][ID] = cache_get_field_content_int(i"id");
              
teleportfixer[i][Owner] = cache_get_field_content_int(i"owner");
              new 
str2[32]; format(str2sizeof(str2), "owner: %d"teleportfixer[i][Owner]); printf(str2);
              
cache_get_field_content(i"name"getstr);
              
format(teleportfixer[i][Name], 32getstr);
            
teleportfixer[i][X1] = cache_get_field_content_float(i"x1");
            
teleportfixer[i][Y1] = cache_get_field_content_float(i"y1");
            
teleportfixer[i][Z1] = cache_get_field_content_float(i"z1");
            
teleportfixer[i][A1] = cache_get_field_content_float(i"a1");
            
teleportfixer[i][Interior1] = cache_get_field_content_int(i"interior1");
            
teleportfixer[i][VirtualWorld1] = cache_get_field_content_int(i"virtualworld1");
            
teleportfixer[i][X2] = cache_get_field_content_float(i"x2");
            
teleportfixer[i][Y2] = cache_get_field_content_float(i"y2");
            
teleportfixer[i][Z2] = cache_get_field_content_float(i"z2");
            
teleportfixer[i][A2] = cache_get_field_content_float(i"a2");
            
teleportfixer[i][Interior2] = cache_get_field_content_int(i"interior2");
            
teleportfixer[i][VirtualWorld2] = cache_get_field_content_int(i"virtualworld2");
            
teleportfixer[i][Price] = cache_get_field_content_int(i"price");
            
teleportfixer[i][Lock] = cache_get_field_content_int(i"lock");
            new 
str[32];
            for(new 
j5j++)
            {
                
format(strsizeof(str), "key_%d"j);
                
teleportfixer[i][Key][j] = cache_get_field_content_int(istr);
            }
        }
        for(new 
0rowsi++)
        {
            
TeleportDB[teleportfixer[i][ID]][ID] = teleportfixer[i][ID];
            
TeleportDB[teleportfixer[i][ID]][Owner] = teleportfixer[i][Owner];
            new 
str2[32]; format(str2sizeof(str2), "owner x: %d"TeleportDB[teleportfixer[i][ID]][Owner]); printf(str2);
            
format(str2sizeof(str2), "owner: %d"teleportfixer[i][Owner]); printf(str2);
            
TeleportDB[teleportfixer[i][ID]][Name] = teleportfixer[i][Name];
            
TeleportDB[teleportfixer[i][ID]][X1] = teleportfixer[i][X1];
            
TeleportDB[teleportfixer[i][ID]][Y1] = teleportfixer[i][Y1];
            
TeleportDB[teleportfixer[i][ID]][Z1] = teleportfixer[i][Z1];
            
TeleportDB[teleportfixer[i][ID]][A1] = teleportfixer[i][A1];
            
TeleportDB[teleportfixer[i][ID]][Interior1] = teleportfixer[i][Interior1];
            
TeleportDB[teleportfixer[i][ID]][VirtualWorld1] = teleportfixer[i][VirtualWorld1];
            
TeleportDB[teleportfixer[i][ID]][X2] = teleportfixer[i][X2];
            
TeleportDB[teleportfixer[i][ID]][Y2] = teleportfixer[i][Y2];
            
TeleportDB[teleportfixer[i][ID]][Z2] = teleportfixer[i][Z2];
            
TeleportDB[teleportfixer[i][ID]][A2] = teleportfixer[i][A2];
            
TeleportDB[teleportfixer[i][ID]][Interior2] = teleportfixer[i][Interior2];
            
TeleportDB[teleportfixer[i][ID]][VirtualWorld2] = teleportfixer[i][VirtualWorld2];
            
TeleportDB[teleportfixer[i][ID]][Price] = teleportfixer[i][Price];
            for(new 
j5j++)
            {
                
TeleportDB[teleportfixer[i][ID]][Key][j] = teleportfixer[i][Key][j];
            }
            
TeleportPickup1[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamicPickup(191321TeleportDB[teleportfixer[i][ID]][X1], TeleportDB[teleportfixer[i][ID]][Y1], TeleportDB[teleportfixer[i][ID]][Z1], TeleportDB[teleportfixer[i][ID]][VirtualWorld1],
            
TeleportDB[teleportfixer[i][ID]][Interior1], -1100);
            
TeleportPickup2[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamicPickup(191321TeleportDB[teleportfixer[i][ID]][X2], TeleportDB[teleportfixer[i][ID]][Y2], TeleportDB[teleportfixer[i][ID]][Z2], TeleportDB[teleportfixer[i][ID]][VirtualWorld2],
            
TeleportDB[teleportfixer[i][ID]][Interior2], -1100);
            new 
string[256], tpname[32];
            
format(tpnamesizeof(tpname), "%s"TeleportDB[teleportfixer[i][ID]][Name]);
            if(
TeleportDB[teleportfixer[i][ID]][Price] > 0)
            {
                
format(stringsizeof(string), "[Teleport: %d]\n{00FFFF}Owner: {FFFFFF}%s\n{00FFFF}For Sale: {FFFFFF}$%s"TeleportDB[teleportfixer[i][ID]][ID], OfflinePlayerName(TeleportDB[teleportfixer[i][ID]][Owner]), Comma(TeleportDB[teleportfixer[i][ID]][Price]));
            }
            else
            {
                
format(stringsizeof(string), "[Teleport: %d]\n{00FFFF}Owner: {FFFFFF}%s"TeleportDB[teleportfixer[i][ID]][ID], OfflinePlayerName(TeleportDB[teleportfixer[i][ID]][Owner]));
            }
            
TeleportText1[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamic3DTextLabel(string, -1TeleportDB[teleportfixer[i][ID]][X1], TeleportDB[teleportfixer[i][ID]][Y1], TeleportDB[teleportfixer[i][ID]][Z1], 5.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0TeleportDB[teleportfixer[i][ID]][VirtualWorld1],
            
TeleportDB[teleportfixer[i][ID]][Interior1], -1100.0);
            
TeleportText2[TeleportDB[teleportfixer[i][ID]][ID]] = CreateDynamic3DTextLabel(string, -1TeleportDB[teleportfixer[i][ID]][X2], TeleportDB[teleportfixer[i][ID]][Y2], TeleportDB[teleportfixer[i][ID]][Z2], 5.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0TeleportDB[teleportfixer[i][ID]][VirtualWorld2],
            
TeleportDB[teleportfixer[i][ID]][Interior2], -1100.0);
            
MessageToAll(TYPE_SERVER"Teleports reloaded");
        }
    }

samp-server.exe (printf)
PHP код:
owner1
owner
2
owner x
101
owner
101
owner x
112
owner
112 
the owner should remain 1 and 2. not 101 and 112 idk how did we get to this.
Reply
#2

show me TeleportDB enums.
Reply
#3

Quote:
Originally Posted by Mugala
Посмотреть сообщение
show me TeleportDB enums.
PHP код:
enum TeleportInfo
{
    
ID,
    
Name// i just noticed and added [32] but i don't think that's the matter.
    
Owner,
    
Float:X1,
    
Float:Y1,
    
Float:Z1,
    
Float:A1,
    
VirtualWorld1,
    
Interior1,
    
Float:X2,
    
Float:Y2,
    
Float:Z2,
    
Float:A2,
    
VirtualWorld2,
    
Interior2,
    
Lock,
    
Key[5],
    
Price
}
new 
TeleportDB[MAX_TELEPORTS][TeleportInfo]; 
Reply
#4

use MAX_PLAYER_NAME at Name[MAX_PLAYER_NAME]
others are good but I still don't understand why u get this issue try'n to figure out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)