SA-MP Forums Archive
[Include] GVP.inc - GetVehiclePlate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] GVP.inc - GetVehiclePlate (/showthread.php?tid=412325)



GVP.inc - GetVehiclePlate - BullseyeHawk - 01.02.2013

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



Re: GVP.inc - GetVehiclePlate - MichiCZ - 01.02.2013

gj


Re: GVP.inc - GetVehiclePlate - BullseyeHawk - 01.02.2013

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.