Commands help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Commands help (
/showthread.php?tid=652300)
Commands help -
Lixyde - 07.04.2018
Lets say that i will add:
Код:
#define SERVER_NAME "MyServer"
How to make it work, and others like:
Код:
#define SERVER_VERSION "0.00.1"
For example?
How to make it work? What is the command?
I Mean i know i need to add something in
OnGamemodeInit but what is it?
Re: Commands help -
ForCop - 07.04.2018
Quote:
Originally Posted by Lixyde
Lets say that i will add:
Код:
#define SERVER_NAME "MyServer"
How to make it work, and others like:
Код:
#define SERVER_VERSION "0.00.1"
For example?
How to make it work? What is the command?
I Mean i know i need to add something in OnGamemodeInit but what is it?
|
Код:
#define SERVER_NAME "hostname MyServer"
#define MAP_NAME "mapname San Andreas"
#define LANGUAGE "language Russian"
#define GAME_MODE "STUNT/DM/DRIFT"
#define WEB_URL "weburl www.forum.sa-mp.com"
public OnGameModeInit()
{
SendRconCommand(SERVER_NAME);
SendRconCommand(MAP_NAME);
SendRconCommand(LANGUAGE);
SendRconCommand(WEB_URL);
SetGameModeText(GAME_MODE);
return true;
}
Re: Commands help -
scripter112 - 08.04.2018
Пич ако ти трябва помощ ми пиши на скайп gta.abaddon.gta
Re: Commands help -
Codeah - 08.04.2018
#define is a pre-processor directive. You can read more about it
here and
here.
To put it in simple words. It replaces A with B in your code :
This happens before the gamemode/filterscript is compiled and only affects lines below the directive.
Here is an example :
Код:
#define SERVER_VERSION "0.00.1"
#define SOME_IDENTIFIER print("Oh, hey there!");
#define foo(%0) print(%0)
public OnGameModeInit()
{
SOME_IDENTIFIER
foo("Oh, hey there!");
SetGameModeText("MyGameMode v" #SERVER_VERSION);
}
Note : When interpolating strings you need to put a number sign/hash (#) before the identifier.