04.01.2013, 09:12
(
Last edited by Sinner; 04/01/2013 at 02:51 PM.
)
Introduction
Let's face it, as well as a coder as you are you can't do everything yourself. At one point your gamemode will require additional includes, plugins and filterscripts. I made this discussion so we can elaborate on the things any server should at least have. I know of a couple any server needs--depending on the server type--and you are free to add more.
Command processors
Any and all servers need a command processor. Sure you can write every command under OnPlayerCommandText using strcmp() and strok but this method is very outdated, unorganized and gets exponentially slower as you add more commands. You are better of using one of the very fast command processors available.
Streamers
There is (to me) only 1 correct option here. Incognito's Streamer Plugin is written entirely in C++ and therefore skips a lot of overhead (PAWN uses more resources than C++), making it the fastest streamer available. A lot faster than any streamer written in PAWN.
ISP can stream a variety of things such as objects, (racing)checkpoints, pickups, ...
String scanners and modifiers
There are a few you can use depending on what you can to do.
For extremely fast and efficient looping though players, vehicles or custom arrays you made yourself, use foreach(). There are as far as I know no alternatives that give comparable speed.
__
TBC, feel free to add to it. Template:
Let's face it, as well as a coder as you are you can't do everything yourself. At one point your gamemode will require additional includes, plugins and filterscripts. I made this discussion so we can elaborate on the things any server should at least have. I know of a couple any server needs--depending on the server type--and you are free to add more.
Command processors
Any and all servers need a command processor. Sure you can write every command under OnPlayerCommandText using strcmp() and strok but this method is very outdated, unorganized and gets exponentially slower as you add more commands. You are better of using one of the very fast command processors available.
- y_cmd - The fastest (arguably) and most flexible processor, also features a "help" parameter so you can easily add help messages to any command
- zcmd - Around the same speed as y_cmd but more widely used although this processor is less flexible
- dcmd - To date still the most widely used command processor, although this still uses strcmp(), dcmd will get slower as you add more commands
Streamers
There is (to me) only 1 correct option here. Incognito's Streamer Plugin is written entirely in C++ and therefore skips a lot of overhead (PAWN uses more resources than C++), making it the fastest streamer available. A lot faster than any streamer written in PAWN.
ISP can stream a variety of things such as objects, (racing)checkpoints, pickups, ...
String scanners and modifiers
There are a few you can use depending on what you can to do.
- sscanf(2) - Scanning a string (for anything really, sscanf features a ton of variable types aswel as enums, arrays, ...) Highly recommended for commands, mysql loading and saving, etc...
- explode - Splitting a string into an array based on a delimiter, sscanf can do this aswel although I understand some people find this harder
- split - Similar to explode, split will split up (obviously) a string into parts depending on a delimiter
- strtok - Anyone using this should be bitchslapped, don't use as it's slow and outdated and anything you may be able to do with strtok sscanf can do aswel
- Regular expressions (regex plugin) - Reading a string for a specific format, validating a string (for perhaps length or wether or not it's a roleplay name), case checking, ... You name it, regular expressions can do it. Regular Expressions is a more advanced technique of reading and checking strings but definitely worth learning since it's THE most commonly used way to check strings in most programming languages. You can learn more about them here (wikipedia) or ****** them.
For extremely fast and efficient looping though players, vehicles or custom arrays you made yourself, use foreach(). There are as far as I know no alternatives that give comparable speed.
__
TBC, feel free to add to it. Template:
Code:
Subject Explanation