[Ajuda] Criar carro na hora de logar destruir quando deslogar
#2

Testa ae...

PHP Code:

new carDono[MAX_PLAYERS];//Variavel pode ser subistituida pelo "pInfo" colocar no TOPO da GM ou FS
case 2000:
        {
            if(!
response) return RemovePlayerFromVehicle(playerid);
            new 
money GetPlayerMoney(playerid);
            if(
money Valor_Manana)
            {
                
RemovePlayerFromVehicle(playerid);
                
SCM(playerid, -1"Voce Nao tem dinheiro suficiente para esse veiculo");
            }
            
GivePlayerMoney(playerid, -Valor_Manana);
            
carDono[playerid] = CreateVehicle(4102127.4617,-1141.9835,24.9416,5.449611, -1);
            
PutPlayerInVehicle(playeridcarDono[playerid], 0);
            new 
file[50];
            
format(file50"Veiculos/%s.ini"PegarNome(playerid));
            if( !
DOF2_FileExists(file) )
            {
                
DOF2_CreateFile(file);
                
DOF2_SetString(file"Dono"PegarNome(playerid));
                
DOF2_SetInt(file"Modelo"410);
                
DOF2_SetFloat(file"CordX",2127.4617);
                
DOF2_SetFloat(file"CordY",-1141.9835);
                
DOF2_SetFloat(file"CordZ",24.9416);
                
DOF2_SetFloat(file"CordA",5.4496);
                
DOF2_SetInt(file"Cor1"1);
                
DOF2_SetInt(file"Cor2"1);
                
DOF2_SaveFile();
            }
        }
public 
OnPlayerConnect(playerid)
{
    
carDono[playerid] = 0;
    new 
file[50];
    
format(file50"Veiculos/%s.ini"PegarNome(playerid));
    if(!
DOF2_FileExists(file))
    {
        
carDono[playerid] = CreateVehicle(DOF2_GetInt(file"Modelo"), DOF2_GetFloat(file"CordX"), DOF2_GetFloat(file"CordY"), DOF2_GetFloat(file"CordZ"), DOF2_GetFloat(file"CordA"), DOF2_GetInt(file"Cor1"), DOF2_GetInt(file"Cor2"), -1);
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
file[50];
    
format(file50"Veiculos/%s.ini"PegarNome(playerid));
    if(!
DOF2_FileExists(file))
    {
        
DOF2_SetString(file"Dono"PegarNome(playerid));
        
DOF2_SetInt(file"Modelo"410);
        
DOF2_SetFloat(file"CordX",2127.4617);
        
DOF2_SetFloat(file"CordY",-1141.9835);
        
DOF2_SetFloat(file"CordZ",24.9416);
        
DOF2_SetFloat(file"CordA",5.4496);
        
DOF2_SetInt(file"Cor1"1);
        
DOF2_SetInt(file"Cor2"1);
        
DOF2_SaveFile();
        
DestroyVehicle(carDono[playerid]);//Destroi o veiculo apos salva-lo
    
}
    return 
1;

Reply


Messages In This Thread
Criar carro na hora de logar destruir quando deslogar - by moura98 - 19.04.2019, 00:45
Re: Criar carro na hora de logar destruir quando deslogar - by AdrianoStk - 19.04.2019, 01:28
Re: Criar carro na hora de logar destruir quando deslogar - by GuiKommander - 19.04.2019, 02:14

Forum Jump:


Users browsing this thread: 1 Guest(s)