Using Includes more as Frameworks
#1

Using Includes (and plugin(s)) more as Frameworks
As primarily a PHP coder, I started off using includes just to include my other work, and splitting the work in to separate files. There are advantages to doing this in Pawn, but personally I prefer just to put everything significant inside my gamemode and use includes for including the SA-MP natives in to my script. I never thought includes were very useful until last year, I thought just the SA-MP natives and a few zcmd includes would be useful and would save me some time.

But recently, it has become clear to me that people really don't use includes as they should be used - many includes have been written by people such as ******, RyDeR`, MP2, Joe Staff and loads of other people - but do you just ignore them because of the compatibility issues with your scripts or just ignore them because you think you can write the code again in a few minutes?

This is a serious problem with scripters in SA-MP, many of us just duck out and become lazy, because we can't be bothered to write our own code anymore. We should be using the resources as they are freely available to us, whether it's a basic command system or a group system.

We should be using includes as frameworks.

The list below is a list of things you should consider using based on what else you're using to create your gamemode - for example, you shouldn't use the SQLite Improved include if you have no intentions of using SQLite.

Here's a short list of includes that are useful and will heavily increase the workload on your script if you use them:
Utilities
Here's a short list of the includes you should use for writing code more efficiently:
fixes.inc
Patching SA-MP bugs you find is not an easy task particularly - you can use this include to patch various SA-MP bugs that have yet to be fixed.

» Read more

Cuff Offsets
MP2 spent a while to get the offsets of the cuff objects for every skin. This is a must-use if you want to use the cuff objects - just for it all to look neat and in place when you apply the object.

» Read more

foreach
foreach replaces some* loops (normally the main player loop) with a faster, more efficient loop.

This is a much neater way to deal with groups of data you need to loop. Not just for player loops, but also for custom arrays using the iterator functions.

» Read more

SQLite Improved
The built-in SQLite is more powerful than most people realize. One issue, however, is that the native functions given are very few and low-level. This library is doing something about that!

While this library mainly has functions that facilitate development, it also brings new functionality and solves crucial bugs.

» Read more

y_ini
In short, y_ini is an include which uses the native SA-MP file functions to provide an easy-to-use set of scripting functions to process INI files. There are plenty of advantages to using this over other released includes, which are outlined in the release thread.

» Read more

y_commands
Personally, I've always preferred using zcmd over y_commands, however y_commands has an advantage - it has support for the other YSI libraries, and more functions available to save you time coding.

This library allows you to create commands efficiently and with ease - you don't have to spend ages using strtok, you can use this in combination with sscanf and save yourself plenty of time.

» Read more

sscanf
There are two (major) versions of sscanf; a version in an include and a version in a plugin. The plugin version has much greater functionality and is a lot more stable - so I'll forward you to that instead of the include.

sscanf allows you to split data from strings in to different variables by a delimiter (it can be anything, as long as it's one character).

The correct pronunciation is apparently es-scan-eff.

» Read more

svAddons
This script adds some useful functions that the SA:MP team decided to not include in the default server package. This include requires your server to be running on 0.3e.

» Read more

svCheats
This script allows you to select all of the cheats you want protection against, change the settings for the cheats, and give certain people a certain security level to bypass anticheat checks.

» Read more

y_timers
This include allows you to quickly and easily define timer functions, that is functions which are to be called after a given time. The library provides two systems: tasks, which are functions that run all the time in the background (for example streamers); and timers, which are functions you can start, stop, and call on a delay at will.

» Read more
Systems
Mainly to annoy the OP, but also a set of libraries to save you from writing a load of code for something you have already in a matter of seconds set out for you. Here's the list:
y_languages and y_text
y_text is the single most complex library in YSI 3.0, but using it is (hopefully) very simple. The library works on the idea from HTML/CSS/JavaScript of separation of content, style and logic.

Whereas, y_languages is intended for scripters to be able to write multilingual modes with the aid of the include.

» Read more

y_groups
What are groups? An admin level is a group of players, a gang is a group of players, a team is a group of players, a faction is group of players - why have different code for each of these things? y_groups is an abstraction of all of these things now supported by most of the YSI libraries to allow you to define exactly who can do what.

» Read more

jBan
jBan is a simple include that will allow server owners to easily have a player banning system using a MySQL database as the storage center for the ban information. It should be compatible with just about every script out there.

» Read more

gCamera
gCamera is an include which allows you to add VERY EASILY speed cameras near highways, it will detect when a player passes it at high speed.

You can set the speed limit in kmh AND mph, and also the limit & fine PER CAMERA! It also includes an pretty awesome flash effect made with textdraws!
» Read more

Player Inventory
It's an easy to use function-adding include to implement inventory for players. It even saves and loads items.

» Read more
Notes:

This is more of a tutorial and a discussion, there are other threads in here too that could just be conceived as tutorials, so here's probably the most relevant place for this type of thread. Also, this.

If you have any suggestions of includes to add, please reply and I'll consider updating this post.
Reply


Messages In This Thread
Using Includes more as Frameworks - by Calgon - 29.06.2012, 14:32
Re: Using Includes more as Frameworks - by SuperViper - 29.06.2012, 16:15
Re: Using Includes more as Frameworks - by MP2 - 29.06.2012, 23:28
Re: Using Includes more as Frameworks - by MP2 - 30.06.2012, 00:53
Re: Using Includes more as Frameworks - by Steven82 - 30.06.2012, 04:14
Re: Using Includes more as Frameworks - by Calgon - 30.06.2012, 15:59
Re: Using Includes more as Frameworks - by cessil - 01.07.2012, 11:47
Re: Using Includes more as Frameworks - by Calgon - 01.07.2012, 11:48
Re: Using Includes more as Frameworks - by ReneG - 01.07.2012, 15:19
Re: Using Includes more as Frameworks - by TheChaoz - 01.07.2012, 15:51

Forum Jump:


Users browsing this thread: 1 Guest(s)