Commands help
#1

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?
Reply
#2

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;
}
Reply
#3

Пич ако ти трябва помощ ми пиши на скайп gta.abaddon.gta
Reply
#4

#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 :
Код:
#define A B
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)