26.05.2014, 12:23
(
Last edited by Rittik; 03/06/2014 at 08:43 AM.
Reason: foreach
)
Introduction
This is my first tutorial, and this tutorial will help you in making your own include files.Making .inc is very simple.But creating functions are not that easy.
Q."What is an Include ?"
A. According to me an include file is nothing but a file which contains functions,parameters,arguments created by you, which makes coding game modes/filterscripts easier. Sorry, if I am wrong.
Syntax
Coding
Q."Where do we have to code an Include file for our server ?"
A. Pawno/Pawn
Q."How ?"
A. Step 1: Just open pawn and press ctrl+n, then remove all the syntax/callbacks and everything.
Step 2: Now start creating your own functions.For Example
Now do not compile it just save it.Then go to the folder where you have saved it as .pwn file, Now rename that .pwn file to .inc
Step 3: Now move that .inc file to pawno\include.
Step 4: Include it to your game mode and you're done.
Thank You
This is my first tutorial, and this tutorial will help you in making your own include files.Making .inc is very simple.But creating functions are not that easy.
Q."What is an Include ?"
A. According to me an include file is nothing but a file which contains functions,parameters,arguments created by you, which makes coding game modes/filterscripts easier. Sorry, if I am wrong.
Syntax
pawn Code:
#include <filename> //An include should always have a .inc format
Coding
Q."Where do we have to code an Include file for our server ?"
A. Pawno/Pawn
Q."How ?"
A. Step 1: Just open pawn and press ctrl+n, then remove all the syntax/callbacks and everything.
Step 2: Now start creating your own functions.For Example
pawn Code:
//audiostreamforall
stock PlayAudioStreamForAll(url[])
{
foreach (new i : Player)
{
PlayAudioStreamForPlayer(i,url);
}
return url;
}
//stopaudiostreamforall
stock StopAudioStreamForAll()
{
new i;
foreach (i : Player)
{
StopAudioStreamForPlayer(i);
}
return 1;
}
Step 3: Now move that .inc file to pawno\include.
Step 4: Include it to your game mode and you're done.
Thank You