[Ajuda] Problema comando /estacionar
#1

Entгo pessoal,
meu unico problema й que quando um player usa o comando /estacionar tudo que foi modificado no veнculo, pintura, nitro, rodas, etc. й retirado, o veнculo й resetado entao queria saber como eu faзo para salvar toda modificaзao que foi feita no veнculo para nao acontecer isso.


PHP код:
// This command checks if the player is inside a vehicle that he owns and if he's in range of the house where the vehicle is assigned to
COMMAND:estacionar(playeridparams[])
{
    
// Setup local variables
    
new Float:xFloat:yFloat:zFloat:rotvidHouseIDMsg[128];
    new 
engine,lights,alarm,doors,bonnet,boot,objective;
    
// Send the command to all admins so they can see it
    
SendAdminText(playerid"/estacionar"params);
    
// Check if the player has logged in
    
if (APlayerData[playerid][LoggedIn] == true)
    {
        
// Check if the player is inside a vehicle (he must be the driver)
        
if (GetPlayerVehicleSeat(playerid) == 0)
        {
            
// Get the vehicle-id
            
vid GetPlayerVehicleID(playerid);
            
// Get the HouseID to which this vehicle belongs
            
HouseID AVehicleData[vid][BelongsToHouse];
            
// Check if the vehicle is owned (owner-check is not really required, as another player would get kicked out very fast)
            // AND it must belong to a house that the player owns
            
if ((AVehicleData[vid][Owned] == true) && (HouseID != 0))
            {
                
// Check if the vehicle is in range of the house-entrance (you cannot park a vehicle further away from your house than 150m)
                
if (IsPlayerInRangeOfPoint(playeridParkRangeAHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
                {
                    
// Get the player's position and angle
                    
GetVehiclePos(vidxyz);
                    
GetVehicleZAngle(vidrot);
                    
// Save those values for the vehicle
                    
AVehicleData[vid][SpawnX] = x;
                    
AVehicleData[vid][SpawnY] = y;
                    
AVehicleData[vid][SpawnZ] = z;
                    
AVehicleData[vid][SpawnRot] = rot;
                    
// Find the vehicle in the player's houses
                    
for (new iMAX_HOUSESPERPLAYERi++)
                    {
                        
// Get the HouseID of the current house
                        
HouseID APlayerData[playerid][Houses][i];
                        
// Loop through all carslots of this house to find the vehicle-id
                        
for (new CarSlotCarSlot 10CarSlot++)
                        {
                            
// Check if this carslot holds the same vehicle-id
                            
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
                            {
                                
House_ReplaceVehicle(HouseIDCarSlot); // Re-create the vehicle at the same spot the player wants to park his vehicle
                                
PutPlayerInVehicle(playeridAHouseData[HouseID][VehicleIDs][CarSlot], 0);
                                
// Turn on the engine
                                
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], enginelightsalarmdoorsbonnetbootobjective);
                                
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1lightsalarmdoorsbonnetbootobjective);
                                break; 
// Stop the for-loop
                            
}
                        }
                    }
                    
SendClientMessage(playerid0x00FF00FF">>> Vocк estacionou o seu veнculo.");
                    
PlayerFile_Save(playerid);
                }
                else
                {
                    
format(Msg128"{FF0000}>>> Vocк precisa estar dentro do veнculo da sua casa para estacionб-lo!"ParkRange);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                }
            }
            else
                
SendClientMessage(playerid0xFF0000FF">>> Vocк nгo pode estacionar um veнculo que nгo й da sua propriedade!");
        }
        else
            
SendClientMessage(playerid0xFF0000FF">>> Vocк deve estar dentro do veнculo para estacionб-lo!");
    }
    else
        return 
0;
    return 
1;

Reply
#2

Alguem me ajuda PF
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)