Cmd not working for new vehicles
#1

Hello, I made a command to open/close vehicle trunks. It works for vehicles that were spawned when the server first started up but any other vehicles spawned afterwards through for example /vspawner won't respond to the command. I tried using MAX_VEHICLES but that made no difference.

pawn Код:
CMD:trunk(playerid, params[]) //New vehicles won't work
{
    new engine,lights,alarm,doors,bonnet,boot,objective,Float:x,Float:y,Float:z;
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You can't do this while inside a vehicle.");
    for(new i = 0; i < GetVehiclePoolSize(); i++)
    {
        GetVehiclePos(i, x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 4, x, y, z))
        {
            GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
            if(boot == VEHICLE_PARAMS_ON)
            {
                SetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
                return 1;
            }
            else
            {
                SetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
                return 1;
            }
        }
    }
    return 1;
}
If anyone has any ideas on why this doesn't work, it would be appreciated.
Reply


Messages In This Thread
Cmd not working for new vehicles - by Randouso - 17.01.2017, 10:51
Re: Cmd not working for new vehicles - by Dayrion - 17.01.2017, 10:56
Re: Cmd not working for new vehicles - by Randouso - 17.01.2017, 11:11
Re: Cmd not working for new vehicles - by Logic_ - 17.01.2017, 11:49

Forum Jump:


Users browsing this thread: 1 Guest(s)