Adding Func. in less lines possible
#7

Psymetrix method is not very good either and completely sidesteps the issue of not having your own scripted create and delete vehicle. If you did this then you would be adding vehicles like this....


pawn Код:
#define VEHICLE_TYPE_SOMETHING 1

enum VINFO
{
   vID,
   vType
}

new VehicleData[MAX_VEHICLES][VINFO] = { INVALID_VEHICLE_ID, ... };

AddVehicle(vehicletype, Float:x, Float:y, Float:z, Float:fa, color1, color2, respawntime)
{
    new index = CreateVehicle(........);
    VehicleData[index][vID] = index;
    VehicleData[index][vType] = VEHICLE_TYPE_SOMETHING;
}

IsASomething(vehicleid)
{
    if(VehicleData[vehicleid][vType] == VEHICLE_TYPE_SOMETHING) return 1;
    return 0;
}
This should give you a better idea the vehicleid becomes the array reference in VehicleData, this way you can see what the vehicle type is without doing any looping, creating extra arrays etc. In fact you can do the following with this kind of setup

- add many different kinds of vehicles types
- remove any vehicle
- define more data members in the enum to keep track of fuel, position etc
Reply


Messages In This Thread
Adding Func. in less lines possible - by Stereotype - 06.08.2013, 12:44
Re: Adding Func. in less lines possible - by Konstantinos - 06.08.2013, 12:51
Re: Adding Func. in less lines possible - by Stereotype - 06.08.2013, 12:57
Re: Adding Func. in less lines possible - by Psymetrix - 06.08.2013, 19:45
Re: Adding Func. in less lines possible - by Misiur - 06.08.2013, 19:49
Re: Adding Func. in less lines possible - by Stereotype - 08.08.2013, 15:28
Re: Adding Func. in less lines possible - by Pottus - 08.08.2013, 17:35
Re: Adding Func. in less lines possible - by Stereotype - 09.08.2013, 11:32

Forum Jump:


Users browsing this thread: 2 Guest(s)