29.08.2016, 12:47
There are some things you should think about
1. You should use static and stock.
For example if someone only wanna use 1 or 2 functions, he dont need the others.
So use stock for Variables and Functions if you write an Include.
The other thing is, imagine he uses the same variable name like u.
Then it comes to an Error, so that this never happens use static so your include has his own scope
2. Huge Space Wasting
10 (there are 10 Vars)*500 (MAX_PLAYERS)*4 (4Bytes per Cell)
= 20.000Bytes = ~19.53 KB
So...this isnt a complex system and an user wanna use it and instant waste 19.53 KB...
In Pawn this is much space and most time this all doesn't get used.
So it is wasted.
Temporary Vars, when u just wanna save a var over a short time, for example Dialog choosing, or for commands and then using dialogs, it is perfect to use PVars, cause you can delete it right after you used it and save a lot of space.
For other things it is neat to use Propertys, because if you do this, you can use as much as your Server RAM is big
And most of your vars are only for a short distance so use PVar, and delete it right after you used it
3. Why use MySQL?
MySQL can do huge problems for not so experienced users or with plugins and microsoft or linux.
So just use SQLite so, the user doesn't need to make a huge thing about your include.
Try to make it smart, so that it runs perfect
4. Injections
There are some open bugs in your code
For example if you save the vars, you use for the name %s, but if i write an injection in the name, so yeah you right load it
So you should use %q instead or escape the string
5. Defines
At the End of the Include you should undefine your defines.
For example
And you should do the start like this:
So that you can redefine it from the Script and dont need to edit your include
So far some points, but all in all it isn't that bad
Good that you use Streamer functions and an Iteration Include
And nice idea, so good job anyway
1. You should use static and stock.
For example if someone only wanna use 1 or 2 functions, he dont need the others.
So use stock for Variables and Functions if you write an Include.
The other thing is, imagine he uses the same variable name like u.
Then it comes to an Error, so that this never happens use static so your include has his own scope
2. Huge Space Wasting
PHP код:
new
Float: CCTV_oldX[MAX_PLAYERS],
Float: CCTV_oldY[MAX_PLAYERS],
Float: CCTV_oldZ[MAX_PLAYERS],
Float: CCTV_oldAngle[MAX_PLAYERS],
CCTV_oldSkin[MAX_PLAYERS],
CCTV_oldVW[MAX_PLAYERS],
CCTV_oldInterior[MAX_PLAYERS],
inCCTV[MAX_PLAYERS],
CCTV_ID[MAX_PLAYERS],
CCTV_inEditing[MAX_PLAYERS];
= 20.000Bytes = ~19.53 KB
So...this isnt a complex system and an user wanna use it and instant waste 19.53 KB...
In Pawn this is much space and most time this all doesn't get used.
So it is wasted.
Temporary Vars, when u just wanna save a var over a short time, for example Dialog choosing, or for commands and then using dialogs, it is perfect to use PVars, cause you can delete it right after you used it and save a lot of space.
For other things it is neat to use Propertys, because if you do this, you can use as much as your Server RAM is big
And most of your vars are only for a short distance so use PVar, and delete it right after you used it
3. Why use MySQL?
MySQL can do huge problems for not so experienced users or with plugins and microsoft or linux.
So just use SQLite so, the user doesn't need to make a huge thing about your include.
Try to make it smart, so that it runs perfect
4. Injections
There are some open bugs in your code
For example if you save the vars, you use for the name %s, but if i write an injection in the name, so yeah you right load it
So you should use %q instead or escape the string
5. Defines
At the End of the Include you should undefine your defines.
For example
PHP код:
#undef MAX_CCTV_NAME
PHP код:
#if !defined MAX_CCTV
#define MAX_CCTV 100
#endif
So far some points, but all in all it isn't that bad
Good that you use Streamer functions and an Iteration Include
And nice idea, so good job anyway