14.12.2011, 15:50
(
Последний раз редактировалось BigETI; 15.12.2011 в 18:41.
)
Welcome to this tutorial.
I 've seen alot of peoples releasing filterscripts/gamemodes without having the required knowledge of the current most used libraries. (For example command processors, file stream systems etc.)
But first of all if you have any script ideas or want to improve your releases, so here you'll be in the right place.
Anyways now before releasing anything, ofc you have to create something. In my opinion copied scripts from well known gamemodes aren't much unique and in some cases they're also very bugged. So I prefer using own ideas and they might be often more unique and also less buggier at all.
Of course before scripting anything you have to open your PAWN script editor. :P
Good! Now you have to decide if you want to write a filterscript or a gamemode. (Or even a NPC script!)
If you decide for a filterscript and you might want to use some special includes (example ZCMD, ncbs, btxt etc.) you NEED to DEFINE
on TOP of your script, otherwise you'll have troubles later at loading/reloading and unloading the FS.
Wrong FS start example:
or
Correct example:
The question is why I've done this?
First of all I define FILTERSCRIPT on top of the script because if I write a filterscript, I need the proper init callback of the includes (such as OnFilterScriptInit() or OnGameModeInit()!)
From ZCMD:
Peoples who don't know about pre compiler functions, they allow us to do text replacements while compiling.
If we define FILTERSCRIPT on top of these includes, the result would be:
These lines shows above how it could compile our code for us after the text replacement. These functions above does gets called after loading your filterscript, otherwise..
these lines above does not have a valid sense and they get called after gamemode start..
So peoples without defining FILTERSCRIPT above their filterscript will just compile the wrong inits of the includes which causes to incompatibility.
For gamemode developer you don't have to use this define in your gamemode script.
I've seen bunch of gamemodes are starting like this:
The part where the compiler checks if FILTERSCRIPT is defined will be unused so you can easily delete it also.
Good after bunch time of dev you're probably done with your filterscript/gamemode and now you want to release your work here on this forum. If you want to release a filterscript, you can post your work here: http://forum.sa-mp.com/forumdisplay.php?f=17
Otherwise if you want to release a gamemode just use this forum: http://forum.sa-mp.com/forumdisplay.php?f=71
After that you press the "New Topic" button and write stuff in your topic.
Please do your a favour and make your topic nice and readable for others to prevent any stupid comments for it.
Example how a stupid topic could be:
There is nothing explained above and uses a huge font size.
Such posts deserves ofc bad comments below :P
How nicer your topic is, so much rep+ you get
Now you probably ask yourself where you can upload your stuff?
I prefer to upload small scripts in Pastebin or any another uploader easily foundable in ******.
If you want to show scripts on topic, please use the proper higlighting.
I've seen bunch of script examples highlighted in wrong scripting language. Best way is to use
[pawn]Your code...[/pawn]
for your PAWN scripts.
Asking for reputation or sharing junked links (danger of hacker/virus attacks) will be mostly reported to the forum mods/admins.
I hope I've helped you about the common sense of releasing any scripts.
If you find any grammar mistakes, just PM me or just leave a comment below.
Of course I accept suggestions related to this topic.
Regards: BigETI
I 've seen alot of peoples releasing filterscripts/gamemodes without having the required knowledge of the current most used libraries. (For example command processors, file stream systems etc.)
But first of all if you have any script ideas or want to improve your releases, so here you'll be in the right place.
Anyways now before releasing anything, ofc you have to create something. In my opinion copied scripts from well known gamemodes aren't much unique and in some cases they're also very bugged. So I prefer using own ideas and they might be often more unique and also less buggier at all.
Of course before scripting anything you have to open your PAWN script editor. :P
Good! Now you have to decide if you want to write a filterscript or a gamemode. (Or even a NPC script!)
If you decide for a filterscript and you might want to use some special includes (example ZCMD, ncbs, btxt etc.) you NEED to DEFINE
pawn Код:
#define FILTERSCRIPT
Wrong FS start example:
pawn Код:
#include <ncbs>
#include <zcmd>
//...Some code
pawn Код:
#include <ncbs>
#include <zcmd>
#define FILTERSCRIPT
//...Some code
pawn Код:
#define FILTERSCRIPT
#include <ncbs>
#include <zcmd>
//...Some code
First of all I define FILTERSCRIPT on top of the script because if I write a filterscript, I need the proper init callback of the includes (such as OnFilterScriptInit() or OnGameModeInit()!)
From ZCMD:
pawn Код:
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
return CallLocalFunction("zcmd_OnFilterScriptInit", "");
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit zcmd_OnFilterScriptInit
forward zcmd_OnFilterScriptInit();
#else /*not a filterscript*/
public OnGameModeInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
if (funcidx("zcmd_OnGameModeInit") != -1)
{
return CallLocalFunction("zcmd_OnGameModeInit", "");
}
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit zcmd_OnGameModeInit
forward zcmd_OnGameModeInit();
#endif /*if defined FILTERSCRIPT*/
If we define FILTERSCRIPT on top of these includes, the result would be:
pawn Код:
public OnFilterScriptInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
return CallLocalFunction("zcmd_OnFilterScriptInit", "");
}
forward zcmd_OnFilterScriptInit();
//..other lines
pawn Код:
public OnGameModeInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
if (funcidx("zcmd_OnGameModeInit") != -1)
{
return CallLocalFunction("zcmd_OnGameModeInit", "");
}
return 1;
}
//..other lines
So peoples without defining FILTERSCRIPT above their filterscript will just compile the wrong inits of the includes which causes to incompatibility.
For gamemode developer you don't have to use this define in your gamemode script.
I've seen bunch of gamemodes are starting like this:
pawn Код:
#if defined FILTERSCRIPT
//..Some of your codes (example hilarios defines, unused functions, includes etc.)
#else
//..Also some of your codes
#endif
Good after bunch time of dev you're probably done with your filterscript/gamemode and now you want to release your work here on this forum. If you want to release a filterscript, you can post your work here: http://forum.sa-mp.com/forumdisplay.php?f=17
Otherwise if you want to release a gamemode just use this forum: http://forum.sa-mp.com/forumdisplay.php?f=71
After that you press the "New Topic" button and write stuff in your topic.
Please do your a favour and make your topic nice and readable for others to prevent any stupid comments for it.
Example how a stupid topic could be:
Quote:
HAHAHA I made cool FS :P :P :P plis download HERE! |
Such posts deserves ofc bad comments below :P
How nicer your topic is, so much rep+ you get
Now you probably ask yourself where you can upload your stuff?
I prefer to upload small scripts in Pastebin or any another uploader easily foundable in ******.
If you want to show scripts on topic, please use the proper higlighting.
I've seen bunch of script examples highlighted in wrong scripting language. Best way is to use
[pawn]Your code...[/pawn]
for your PAWN scripts.
Asking for reputation or sharing junked links (danger of hacker/virus attacks) will be mostly reported to the forum mods/admins.
I hope I've helped you about the common sense of releasing any scripts.
If you find any grammar mistakes, just PM me or just leave a comment below.
Of course I accept suggestions related to this topic.
Regards: BigETI