28.03.2016, 09:35
The trunk won't open mabye you guys can help me out?
PHP код:
CMD:trunk(playerid, params[])
{
new
id = -1;
if ((id = Car_Nearest(playerid)) != -1)
{
if (IsVehicleImpounded(CarData[id][carVehicle]))
return SendErrorMessage(playerid, "This vehicle is impounded and you can't use it.");
if (IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "You must exit the vehicle first.");
if (!IsDoorVehicle(CarData[id][carVehicle]))
return SendErrorMessage(playerid, "This vehicle doesn't have a trunk.");
if (CarData[id][carLocked])
return SendErrorMessage(playerid, "The vehicle's trunk is locked.");
for (new i = 1; i != MAX_VEHICLES; i ++) if (IsValidVehicle(i))
{
if (!GetTrunkStatus(i))
{
SetTrunkStatus(i, true);
ApplyAnimation(playerid, "CARRY", "liftup", 3.0, 0, 0, 0, 0, 0);
Car_ShowTrunk(playerid, id);
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s has opened the trunk of the vehicle.", ReturnName(playerid, 0));
ShowPlayerFooter(playerid, "You have ~g~opened~w~ the trunk!");
}
else
{
SetTrunkStatus(i, false);
ApplyAnimation(playerid, "CARRY", "putdwn", 3.0, 0, 0, 0, 0, 0);
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s has closed the trunk of the vehicle.", ReturnName(playerid, 0));
ShowPlayerFooter(playerid, "You have ~g~closed~w~ the trunk!");
}
return 1;
}
}
SendErrorMessage(playerid, "You are not in range of any vehicle.");
return 1;
}
PHP код:
stock GetTrunkStatus(vehicleid)
{
static
engine,
lights,
alarm,
doors,
bonnet,
boot,
objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if (boot != 1)
return 0;
return 1;
}
PHP код:
stock SetTrunkStatus(vehicleid, status)
{
static
engine,
lights,
alarm,
doors,
bonnet,
boot,
objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
return SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, status, objective);
}