May have found a bug with GetVehicleParamsCarDoors.
#1

DISREGARD THIS, ANYONE HAVING THE SAME ISSUE THIS IS THE REASON WHY:

Quote:

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.

pawn Код:
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]);
            }
        }
Sometimes it works, sometimes it doesn't. When I checked the status of the printf (CAR DOOR STATUS), it returned -1.

I do this when the vehicles load in (ongamemodeinit).
pawn Код:
SetVehicleParamsCarDoors(x, 0,0,0,0);
The doors are all set to closed and it does indeed spawn closed, but when I use my command it results in the 'else' statement.

Unless above you can see any issues? It's almost coded exactly the same as the windows and it works perfectly.

Thanks in advance,
Grant.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)