New to scripting
#1

Hey guys. I decided I would develop my own server. Now, I do have a few questions. First off, what do the includes do? I have seen them in other servers, but I have no idea what to do with them. For example, i see:

#include <a_samp>
#include <utils>
#include <dutils>
#include <a_zones_brk>
#include <Dini>
#include <Souvlaki_AC>
#include <streamer>
#include <audio>
#include <filemanager>
#include <easy_vehicle>
#include <foreach>

Could someone expand on an explanation for these please? Not every single what, just what an include does. Also, I see multiple definitions. How do the definitions work? I understand the colors, but I don't understand a few other things, such as:

#define REGISTERDIALOG 1
#define LOGINDIALOG 2

and also:

#define TEAM_CYAN 1
#define TEAM_BLUE 2
#define TEAM_GREEN 3
#define TEAM_ORANGE 4
#define TEAM_COR 5
#define TEAM_BAR 6
#define TEAM_TAT 7
#define TEAM_CUN 8
#define TEAM_STR 9
#define TEAM_HIT 10
#define TEAM_ADMIN 11

I also noticed many "forward" lines, what would these do?

forward RemovePlayerWeapon(playerid, weaponid);
forward SaveTrunk();
forward LoadTrunk();
forward CanDriveThruAgain(playerid);
forward Float:GetDistance(playerid, Float, Float:y);
forward TraceLastCall();
forward ReduceTimer(playerid);

There are also lines starting with "new":

new productiontimer;
new SetWorld;
new accountstimer;
new checkgastimer;
new stoppedvehtimer;
new checkcarhealthtimer;
new cartimer;

What do these do and how do they work? Just to let you know, these #define, #include, new, and forward lines are not all of them that are in the script. Could someone give me the basic definitions of the #define, #include, new, and forward? Thanks!
Reply
#2

this is all explained on the wiki

https://sampwiki.blast.hk/wiki/Scripting_Basics

start there and then work your way to the pawn language ref.
Reply
#3

Thanks
Reply
#4

Includes, are a list of functions/stocks that are called to the server.
Definitions, defines things you use to be basic.
Like.. Say you are using a message over and over again.

#define MESSAGE1 "Message"

Then, on your ClientMessage, you would put "MESSAGE1" instead of your text.

"new" is creating a variable. Like. "new IsInDm[MAX_PLAYERS];" Will create a global variable.

forward, is for a created function, you know, the "public function(playerid) example."

When you create a function, you must forward it. forward function(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)