Trucking script Help
#7

Read what I said, you probably deleted or created a vehicle before this one it's a terrible design and this is why you create proper dynamic systems relying on specific vehicle id's and expecting them not to change during development is a terrible assumption. Fortunately this is a very easy problem I'll give you an example however it will require updating all of your code.

pawn Код:
#define CAR_TYPE_COPCAR 0

new gCarData[MAX_VEHICLES] = { INVALID_VEHICLE_ID, ... };

public OnGameModeInit()
{
    AddDynamicCar(596,1595.3313,-1709.8433,5.6725,180.4009,16,1, 3600, CAR_TYPE_COPCAR);

}

stock AddDynamicCar(model, Float:cx, Float:cy: Float:cz, Float:cfa, color1, color2, respawndelay, cartype)
{
    new vindex = CreateVehicle(modelid, cx, cy, cz, cfa, color1, color2, respawndelay);
    if(vindex != INVALID_VEHICLE_ID)
    {
        gCarData[vindex] = cartype;
        return vindex;
    }
    return INVALID_VEHICLE_ID;
}

stock IsACopCar(carid)
{
   if(gCarData[carid] == CAR_TYPE_COPCAR) return 1;
   return 0;
}
You can add any number of vehicle types to that for instance for your logging truck you would need to add..

pawn Код:
#define CAR_TYPE_LOGGING 1

The number doesn't really matter it is a reference, when creating

AddDynamicCar(596,1595.3313,-1709.8433,5.6725,180.4009,16,1, 3600, CAR_TYPE_LOGGING );

Checking

stock IsALogging(carid)
{
   if(gCarData[carid] == CAR_TYPE_LOGGING) return 1;
   return 0;
}
How this relates to your code

if(Vehdid == 422)

becomes
if(IsALogging(GetPlayerVehicleID(playerid))

No fuss no bullshit no problems no matter what order your vehicles are created in.
Reply


Messages In This Thread
Trucking script Help - by Zigonja - 31.05.2013, 17:38
Re: Trucking script Help - by mahdi499 - 31.05.2013, 17:42
Re: Trucking script Help - by Zigonja - 31.05.2013, 17:46
Re: Trucking script Help - by mahdi499 - 31.05.2013, 17:47
Re: Trucking script Help - by Pottus - 31.05.2013, 17:48
Re: Trucking script Help - by Zigonja - 31.05.2013, 17:50
Re: Trucking script Help - by Pottus - 31.05.2013, 17:52
Re: Trucking script Help - by Zigonja - 31.05.2013, 17:55
Re: Trucking script Help - by Zigonja - 31.05.2013, 18:53
Re: Trucking script Help - by Zigonja - 31.05.2013, 21:37

Forum Jump:


Users browsing this thread: 1 Guest(s)