The door states will reset to VEHICLE_PARAMS_UNSET (-1) whenever there is a driver or passenger in the vehicle. This is expected behaviour for now because I don't want to enable players to change the door states on any vehicle they want. As for the damage system. The door states and the damage status are seperate. That's just the way the game is designed. It'll be improved over time. For now it's probably only good for closing the doors when they didn't close by themselves, or allowing players to open doors on their unoccupied vehicles. |
CMD:vdoor(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new function[24];
if(sscanf(params, "s[24]", function)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /vdoor [door] Options: 'driver', 'passenger', 'back left', 'back right'.");
new string[128];
new vehicleid = GetClosestCar(playerid);
new driver, passenger, backleft, backright;
GetVehicleParamsCarDoors(vehicleid, driver, passenger, backleft, backright);
new name = GetVehicleModel(vehicleid) - 400;
if(VehOwner[vehicleid] == PlayerSQLID[playerid] || (Faction[playerid] > 0 && VehicleFaction[vehicleid] == Faction[playerid]) || BizOwner[VehBizID[vehicleid]] == PlayerSQLID[playerid] || VehicleSQLID[vehicleid] < 1)
{
if(strcmp(function, "driver", true) == 0)
{
if(driver == 0)
{
SetVehicleParamsCarDoors(vehicleid, 1, passenger, backleft, backright);
format(string, sizeof(string), "* %s has opened the %s's driver door.", GetNameEx(playerid), VehicleNames[name]);
}
else
{
SetVehicleParamsCarDoors(vehicleid, 0, passenger, backleft, backright);
printf("DOOR STATUS %d", driver);
format(string, sizeof(string), "* %s has closed the %s's driver door.", GetNameEx(playerid), VehicleNames[name]);
}
}
SetVehicleParamsCarDoors(x, 0,0,0,0);