[Include] Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions
#1

Extra Iterators for foreach
+Some useful functions

Current Version : v1.0

This include provides some very useful extra iterator for foreach which can be found HERE

The Iterators
The Iterator provided by this include and there description is as below

Vehicles [Contains all vehicle id's create via function CreateVehicle/AddStaticVehicle/AddStaticVehicleEx]
StaticVehicle [Contains all vehicle id's create via function AddStaticVehicle/AddStaticVehicleEx on GameModeInit]
Objects [Contains all objects id's create via function CreateObject]
DynamicObjects [Contains all objects id's create via function CreateDynamicObject]

Example Usage-

here are some example of how to use them
pawn Код:
foreach(new o : Objects)
{

}
pawn Код:
foreach(new v : Vehicles)
{

}
....and so like this for other Iters too


The Functions
This include also provides some useful functions.
The list of function and there description is given below-

GetTotalObjects()
-- Returns the total number of objects in server

GetTotalVehicles() -- Return the total number of vehicles in server

GetTotalStaticVehicles() -- Return the total number of static vehicle in server [Note this is same as the number of vehicle models created that appear on server console when server is started]

GetTotalDynamicObjects()
-- Returns the total number of Dynamic objects in server

IsStaticVehicle(vehicleid) -- Retruns true if vehicleid was created via function AddStaticVehicle/AddStaticVehicleEx on GameModeInit and false if it was not

NOTES

-->Use it in GM script only DONT use this in an FS
-->If the vehicles/objects are created via a Filter Script the this may not work according to your needs caz this keeps a track of script in which it is use
Recommend Usage! Do not use FS for creating or destroing any objects/vehicles while using this include

-->Do not write "#include streamer" after writing the the include line for this[ will caz bug]
Recommend Usage!Write this include line at last of other include lines

-->If there is any include which creates Objects/Vehicles then the line of that include should be placed after the include of this line and make sure the include that are been placed after the include line of this include shouldn't have "#include <streamer>" in them if they have just simpley remove the line from them.

-->Currently the iter size of Dynamic Object is 20,000 if you have more object in server you can edit its size. Just find the line "#define MAX_DYNAMIC 20000" and edit it

Download The Script
The script can be found here -- http://pastebin.com/WZkEGQdm


Credits

SAMP Team [no credits in samp cant be without them]
****** for foreach
and maybe me too?

Reply


Messages In This Thread
Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by BroZeus - 07.07.2014, 12:30
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by JonathanW - 07.07.2014, 12:33
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by iFarbod - 07.07.2014, 12:40
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by BroZeus - 07.07.2014, 12:43
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by Rittik - 07.07.2014, 14:16
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by BroZeus - 07.07.2014, 15:29
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by Rittik - 07.07.2014, 15:36
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by BroZeus - 07.07.2014, 16:04
Re : Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by S4t3K - 07.07.2014, 16:20
Re: Re : Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by BroZeus - 08.07.2014, 04:41
Re : Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by S4t3K - 08.07.2014, 16:47
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by HolisticDev - 14.07.2014, 23:23
Re: Extra Iterators for Foreach[vehicles,objectts...and more] + Some useful Functions - by Battlezone - 15.07.2014, 00:44

Forum Jump:


Users browsing this thread: 1 Guest(s)