SA-MP Forums Archive
[Ajuda] Veiculo nгo destroi - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Veiculo nгo destroi (/showthread.php?tid=663854)



Veiculo nгo destroi - SmokeKiLL - 13.02.2019

Olб, estou tentando fazer com que o veнculo destrуi quando o player sair, mas nгo estб funcionando.

PHP код:
enum vConceInfo
{
    
vTemCarro,
    
vModel,
    
vColorOne,
    
vColorTwo,
    
Float:vLocal[3],
    
Float:vAngle,
    
vehicleconce,
}
new 
ConceInfo[MAX_PLAYERS][MAX_PLAYERCAR][vConceInfo];
// OnPlayerDisconnect
    
for(new 0MAX_PLAYERCARi++)
    {
        if(
ConceInfo[playerid][i][vTemCarro] == 1)
        {
            
DestroyVehicle(ConceInfo[playerid][i][vehicleconce]);
        }
    } 



Re: Veiculo nгo destroi - Felipealves - 13.02.2019

Sу vai deletar se existir entгo faзa um cmd ou use em algum lugar, dps olhe no console o valor se tiver 0 й pq ele n ta armazenando o id do veiculo.
printf("Veiculo ID: %d", ConceInfo[playerid][0][vehicleconce]);

Vocк ta criando o veiculo? ConceInfo[playerid][0][vehicleconce] = CreateVehicle


Re: Veiculo nгo destroi - Malandrin - 13.02.2019

Provavelmente o erro estб na hora de criar o veнculo, poderia mandar esse trecho do cуdigo?


Re: Veiculo nгo destroi - SmokeKiLL - 13.02.2019

PHP код:
stock CarregarCarros(playerid)
{
    new 
string[34], file[100];
    
format(file74"Concessionaria/%s.txt"pName[playerid]);
    if(
DOF2_FileExists(file))
    {
        for(new 
0MAX_PLAYERCARi++)
        {
            
format(stringsizeof(string), "TemCarro_%d"i);
            
ConceInfo[playerid][i][vTemCarro] = DOF2_GetInt(filestring);
            
format(stringsizeof(string), "Modelo_%d"i);
            
ConceInfo[playerid][i][vModel] = DOF2_GetInt(filestring);
            
format(stringsizeof(string), "Cor1_%d"i);
            
ConceInfo[playerid][i][vColorOne] = DOF2_GetInt(filestring);
            
format(stringsizeof(string), "Cor2_%d"i);
            
ConceInfo[playerid][i][vColorTwo] = DOF2_GetInt(filestring);
            
format(stringsizeof(string), "CarroX_%d"i);
            
ConceInfo[playerid][i][vLocal][0] = DOF2_GetFloat(filestring);
            
format(stringsizeof(string), "CarroY_%d"i);
            
ConceInfo[playerid][i][vLocal][1] = DOF2_GetFloat(filestring);
            
format(stringsizeof(string), "CarroZ_%d"i);
            
ConceInfo[playerid][i][vLocal][2] = DOF2_GetFloat(filestring);
            
format(stringsizeof(string), "CarroA_%d"i);
            
ConceInfo[playerid][i][vAngle] = DOF2_GetFloat(filestring);
            if(
ConceInfo[playerid][i][vTemCarro] == 1)
            {
                
ConceInfo[playerid][i][vehicleconce] = CreateVehicle(ConceInfo[playerid][i][vModel],
                
ConceInfo[playerid][i][vLocal][0], ConceInfo[playerid][i][vLocal][1], ConceInfo[playerid][i][vLocal][2],
                
ConceInfo[playerid][i][vAngle], ConceInfo[playerid][i][vColorOne], ConceInfo[playerid][i][vColorTwo], -1);
                
SetVehicleVirtualWorld(ConceInfo[playerid][i][vehicleconce], 0);
                
LinkVehicleToInterior(ConceInfo[playerid][i][vehicleconce], 0);
            }
        }
    }
    return 
1;
}
// Cуdigo quando o cara vai comprar o carro na concessionaria
            
if(ConceInfo[playerid][0][vTemCarro] == 0)
            {
                
ConceInfo[playerid][0][vehicleconce] = CreateVehicle(GetPVarInt(playerid"idcarro_conce"), 2148.0720, -1143.066525.0160, -90.0000GetPVarInt(playerid"id_cor_conce"), GetPVarInt(playerid"id_cor_conce"), -1);
                
PutPlayerInVehicle(playeridConceInfo[playerid][0][vehicleconce], 0);
                
SetVehicleVirtualWorld(ConceInfo[playerid][0][vehicleconce], randomMundo);
            }
            else
            {
                if(
PlayerInfo[playerid][pVIP] == 1)
                {
                    if(
ConceInfo[playerid][1][vTemCarro] == 0)
                    {
                        
ConceInfo[playerid][1][vehicleconce] = CreateVehicle(GetPVarInt(playerid"idcarro_conce"), 2148.0720, -1143.066525.0160, -90.0000GetPVarInt(playerid"id_cor_conce"), GetPVarInt(playerid"id_cor_conce"), -1);
                        
PutPlayerInVehicle(playeridConceInfo[playerid][1][vehicleconce], 0);
                        
SetVehicleVirtualWorld(ConceInfo[playerid][1][vehicleconce], randomMundo);
                    }
                    else if(
ConceInfo[playerid][2][vTemCarro] == 0)
                    {
                        
ConceInfo[playerid][2][vehicleconce] = CreateVehicle(GetPVarInt(playerid"idcarro_conce"), 2148.0720, -1143.066525.0160, -90.0000GetPVarInt(playerid"id_cor_conce"), GetPVarInt(playerid"id_cor_conce"), -1);
                        
PutPlayerInVehicle(playeridConceInfo[playerid][2][vehicleconce], 0);
                        
SetVehicleVirtualWorld(ConceInfo[playerid][2][vehicleconce], randomMundo);
                    }
                    else return 
SendClientMessage(playeridCOLOR_GREY"Voce atingiu o numero maximo de veiculos que pode ter !");
                }
                else return 
SendClientMessage(playeridCOLOR_GREY"Voce ja tem um veiculo, para comprar outro voce deve ser VIP !");
            } 
@Edit Serб que o problema estб aqui?

PHP код:
            new vehicleid GetPlayerVehicleID(playerid),
            
color_1color_2;
            for(new 
0MAX_PLAYERCARi++)
            {
                if(
ConceInfo[playerid][i][vehicleconce] == vehicleid)
                {
                    new 
rand random(sizeof(RandomPosCarConce));
                    
GetVehicleColor(vehicleidcolor_1color_2);
                    
                       
ConceInfo[playerid][i][vTemCarro] = 1;
                       
ConceInfo[playerid][i][vModel] =  GetVehicleModel(vehicleid);
                      
ConceInfo[playerid][i][vColorOne] = color_1;
                    
ConceInfo[playerid][i][vColorTwo] = color_2;
                    
ConceInfo[playerid][i][vLocal][0] = RandomPosCarConce[rand][0];
                    
ConceInfo[playerid][i][vLocal][1] = RandomPosCarConce[rand][1];
                    
ConceInfo[playerid][i][vLocal][2] = RandomPosCarConce[rand][2];
                    
ConceInfo[playerid][i][vAngle] = RandomPosCarConce[rand][3];
                    
SetVehicleVirtualWorld(ConceInfo[playerid][i][vehicleconce], 0);
                    
SetPlayerVirtualWorld(playerid0);
                }
            }