[Ajuda] Sistema de Concessionaria
#2

Basicamente vocк vai seguir o MAX_PLAYERCAR

no caso ele vai sempre o i, ConceInfo[playerid][i] aqui entra ele [vTemCarro] e depois й chamado o enum, entгo se vocк quiser verificar o carro 3 bota, ConceInfo[playerid][2][vTemCarro] ou carro 1 ConceInfo[playerid][1][vTemCarro]. enfim й isso, qualquer coisa mais tarde eu vejo sua duvida.

PHP код:
#define MAX_PLAYERCAR   3
enum vConceInfo 

    
vTemCarro
    
vModel
    
vColorOne
    
vColorTwo
    
Float:vLocal[3], 
    
Float:vAngle
    
vehicleconce

new 
ConceInfo[MAX_PLAYERS][MAX_PLAYERCAR][vConceInfo];
stock SalvarPlayerCarro(playerid

    new 
file[100], nome[24]; 
    
GetPlayerName(playeridnome24); 
    
format(file74"Concessionaria/%s.txt"nome); 
    if(!
DOF2_FileExists(file)) DOF2_CreateFile(file); 
    
// Carros
    
for(new 0MAX_PLAYERCARi++){
        
DOF2_SetInt(file"TemCarro"ConceInfo[playerid][i][vTemCarro]); 
        
DOF2_SetInt(file"Modelo"ConceInfo[playerid][i][vModel]); 
        
DOF2_SetInt(file"Cor1"ConceInfo[playerid][i][vColorOne]); 
        
DOF2_SetInt(file"Cor2"ConceInfo[playerid][i][vColorTwo]); 
        
DOF2_SetFloat(file"CarroX"ConceInfo[playerid][i][vLocal][0]); 
        
DOF2_SetFloat(file"CarroY"ConceInfo[playerid][i][vLocal][1]); 
        
DOF2_SetFloat(file"CarroZ"ConceInfo[playerid][i][vLocal][2]); 
        
DOF2_SetFloat(file"CarroA"ConceInfo[playerid][i][vAngle]); 
    }
    
DOF2_SaveFile(); 
    return 
1

stock CarregarCarro(playerid

    new 
file[100], nome[24]; 
    
GetPlayerName(playeridnome24); 
    
format(file74"Concessionaria/%s.txt"nome); 
    if(
DOF2_FileExists(file)) 
    { 
        for(new 
0MAX_PLAYERCARi++){   
            
ConceInfo[playerid][i][vTemCarro] = DOF2_GetInt(file"TemCarro"); 
            
ConceInfo[playerid][i][vModel] = DOF2_GetInt(file"Modelo"); 
            
ConceInfo[playerid][i][vColorOne] = DOF2_GetInt(file"Cor1"); 
            
ConceInfo[playerid][i][vColorTwo] = DOF2_GetInt(file"Cor2"); 
            
ConceInfo[playerid][i][vLocal][0] = DOF2_GetFloat(file"CarroX"); 
            
ConceInfo[playerid][i][vLocal][1] = DOF2_GetFloat(file"CarroY"); 
            
ConceInfo[playerid][i][vLocal][2] = DOF2_GetFloat(file"CarroZ"); 
            
ConceInfo[playerid][i][vAngle] = DOF2_GetFloat(file"CarroA"); 
            if(
ConceInfo[playerid][i][vTemCarro] == i
            { 
                
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
}  
CMD:estacionar(playerid){
    new 
vehicleid GetPlayerVehicleID(playerid);
    for(new 
0MAX_PLAYERCARi++){
        if(
ConceInfo[playerid][i][vehicleconce] == vehicleid){
            new 
Float:pPos[4];
            
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
            
GetPlayerFacingAngle(playeridpPos[3]);
            
ConceInfo[playerid][i][vLocal][0] = 0.0;
            
ConceInfo[playerid][i][vLocal][1] = pPos[1];
            
ConceInfo[playerid][i][vLocal][2] = pPos[2];
            
ConceInfo[playerid][i][vAngle] = pPos[3];
            
DestroyVehicle(ConceInfo[playerid][i][vehicleconce]);
            
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); 
            break;
        }
    }    
    return 
1;

Reply


Messages In This Thread
Sistema de Concessionaria - by SmokeKiLL - 27.01.2019, 06:55
Re: Sistema de Concessionaria - by Felipealves - 27.01.2019, 10:49
Re: Sistema de Concessionaria - by SmokeKiLL - 27.01.2019, 12:13
Re: Sistema de Concessionaria - by Felipealves - 27.01.2019, 22:26
Re: Sistema de Concessionaria - by SmokeKiLL - 27.01.2019, 22:30
Re: Sistema de Concessionaria - by Felipealves - 27.01.2019, 22:46
Re: Sistema de Concessionaria - by SmokeKiLL - 27.01.2019, 22:53
Re: Sistema de Concessionaria - by SmokeKiLL - 27.01.2019, 23:15
Re: Sistema de Concessionaria - by Felipealves - 28.01.2019, 01:29
Re: Sistema de Concessionaria - by SmokeKiLL - 28.01.2019, 01:51

Forum Jump:


Users browsing this thread: 2 Guest(s)