SetVehicleParamsForPlayerEx hight size
#4

You can optimize the addition by about half by using a "flag".. you can use the bitwise and/or/not operators to do this:

pawn Код:
enum (<<=1)
{
    FLAG_NONE,
    FLAG_VEHICLE_LOCKED = 1,
    FLAG_VEHICLE_OBJECTIVE
};

new iVehicleObjective[MAX_PLAYERS][MAX_VEHICLES];

// we could now do stuff like this:
iVehicleObjective[playerid][vehicleid] |= FLAG_VEHICLE_LOCKED; // add a locked flag
iVehicleObjective[playerid][vehicleid] |= FLAG_VEHICLE_OBJECTIVE; // add an objective flag

// we can "get" the values doing this
iVehicleObjective[playerid][vehicleid] & FLAG_VEHICLE_LOCKED // will be non-zero if set, zero if not set
iVehicleObjective[playerid][vehicleid] & FLAG_VEHICLE_OBJECTIVE // will be non-zero if set, zero if not set
//.. i'm not sure if the functions expect a "true"/"false" for the parameters, but you can convert the above to true/false like this example. You may not need to do this step so test without first, for simplicity:
(iVehicleObjective[playerid][vehicleid] & FLAG_VEHICLE_LOCKED == FLAG_VEHICLE_LOCKED) // will be a true/false result
(iVehicleObjective[playerid][vehicleid] & FLAG_VEHICLE_OBJECTIVE == FLAG_VEHICLE_OBJECTIVE)

// we can "unset" the values doing this
iVehicleObjective[playerid][vehicleid] &= ~FLAG_VEHICLE_LOCKED; // will remove the vehicle locked flag
iVehicleObjective[playerid][vehicleid] &= ~FLAG_VEHICLE_OBJECTIVE; // will remove the vehicle objective flag
You'll probably want to put these as functions rather than hacking around with this low level stuff all the time, it has not been tested on the server but it should work.

Also, make sure you set your MAX_VEHICLES and MAX_PLAYERS to the amount you have in your server. It will greatly decrease the size of your AMX (using your current implementation, you should be using 15625 kbytes of RAM -- if I've calculated that correctly )..
Reply


Messages In This Thread
SetVehicleParamsForPlayerEx hight size - by nico005 - 14.07.2010, 11:05
Re: SetVehicleParamsForPlayerEx hight size - by Grim_ - 14.07.2010, 11:07
Re: SetVehicleParamsForPlayerEx hight size - by nico005 - 14.07.2010, 11:24
Re: SetVehicleParamsForPlayerEx hight size - by Simon - 14.07.2010, 11:50

Forum Jump:


Users browsing this thread: 1 Guest(s)