04.04.2014, 02:46
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.
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(playerid, params[])
{
// Setup local variables
new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[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(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
// Get the player's position and angle
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
// 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 i; i < MAX_HOUSESPERPLAYER; i++)
{
// 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 CarSlot; CarSlot < 10; CarSlot++)
{
// Check if this carslot holds the same vehicle-id
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
{
House_ReplaceVehicle(HouseID, CarSlot); // Re-create the vehicle at the same spot the player wants to park his vehicle
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
// Turn on the engine
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break; // Stop the for-loop
}
}
}
SendClientMessage(playerid, 0x00FF00FF, ">>> Vocк estacionou o seu veнculo.");
PlayerFile_Save(playerid);
}
else
{
format(Msg, 128, "{FF0000}>>> Vocк precisa estar dentro do veнculo da sua casa para estacionб-lo!", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFF0000FF, ">>> Vocк nгo pode estacionar um veнculo que nгo й da sua propriedade!");
}
else
SendClientMessage(playerid, 0xFF0000FF, ">>> Vocк deve estar dentro do veнculo para estacionб-lo!");
}
else
return 0;
return 1;
}