[Include] GVP.inc - GetVehiclePlate
#3

Quote:
Originally Posted by ******
View Post
pawn Code:
// MUCH faster than "format" for copying strings.
#define strcpy(%0,%1) \
    strcat((%0[0] = '\0', %0), %1)

// So other scripts can't use this private variable.
static stock
    PlateText[MAX_VEHICLES][10];

// No need for "public".
stock SetVehiclePlate(vehicleid, platetext[])
{
    strcpy(PlateText[vehicleid], platetext);
    return SetVehicleNumberPlate(vehicleid, platetext);
}
// Rename "SetVehiclePlate" as "SetVehicleNumberPlate".
#if defined _ALS_SetVehicleNumberPlate
    #undef SetVehicleNumberPlate
#else
    #define _ALS_SetVehicleNumberPlate
#endif
#define SetVehicleNumberPlate SetVehiclePlate

// Could also use "GetVehicleNumberPlate" for consistency.
stock GetVehiclePlate(vehicleid)
{
    return PlateText[vehicleid];
}

// Should always be commented out like this.
/*
native SetVehiclePlate(vehicleid, platetext[]);
native GetVehiclePlate(vehicleid);
*/
Thats awesome ******, I would have wanted to try by myself. but I never understood the true way of the _ALS_.
I wanted this from the start, this was originaly for my friend. I asked him for which version does he wants, the _ALS_ one or easy one, then I just released this as my first Include to try and mabye be better in the future.

Thanks ******, I'll try to improve my skills.
Reply


Messages In This Thread
GVP.inc - GetVehiclePlate - by BullseyeHawk - 01.02.2013, 16:28
Re: GVP.inc - GetVehiclePlate - by MichiCZ - 01.02.2013, 16:33
Re: GVP.inc - GetVehiclePlate - by BullseyeHawk - 01.02.2013, 17:04

Forum Jump:


Users browsing this thread: 1 Guest(s)