[Include] GVP.inc - GetVehiclePlate
#1

GetVehiclePlate

Easy Vehicle Plate Getter and Setter


This is my first include, I'm not very proud of it but its something then nothing.

Publics:
Quote:

* SetVehiclePlate(vehicleid, platetext[]) - This function doesn't return a specific value.

Stocks:
Quote:

* GetVehiclePlate(vehicleid) - This function returns vehicle plate text.

Notes
If you use the stock without setting it first with Public it won't work - It'll just return an empty string.
This include is very easy to use, one public that and one stock.
This include allows you to set a vehicle plate and save it so later you can get it trought GetVehiclePlate().
Everything is detailed how to use inside the include. I hope you'll enjoy.

You can check a version by ****** that is 100% better then mine over here: http://forum.sa-mp.com/showpost.php?...94&postcount=3

Download:
Mediafire(GVP.inc): http://www.mediafire.com/?zxj4kjlup7wm87d
Pastebin(GVP.inc): http://pastebin.com/vnfdJ5as
Reply
#2

gj
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)