main() after public functions
#1

Is it allowed to create public function before main() ? Does it change something?
Reply
#2

I think you're allowed to create it, don't see why would that change anything.
Reply
#3

Off course you can create publics before main().
in includes sometimes callbacks are created also, and it works fine, doesnt it?
Reply
#4

I don't generally see a valid purpose for main. Anything done there can be done in OnGamemodeInit
Reply
#5

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
I don't generally see a valid purpose for main. Anything done there can be done in OnGamemodeInit
yeah but main is called before OnGameModeInit
Reply
#6

PAWN is based on C, main is for the compiler to know where the program starts, thats how I recall it.
Reply
#7

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
yeah but main is called before OnGameModeInit
do a printf in main, it'll get called after ongamemodeinit
Reply
#8

Quote:
Originally Posted by Donya
Посмотреть сообщение
do a printf in main, it'll get called after ongamemodeinit
Quote:

main()
{
//callbacks that are called at the start of the gamemode, "hidden"
print("your text");
}

The text will be printed after gamemodeinit, because it will execute before print, in the main()
Reply
#9

the order doesn't matter, if you will define OnGameModeInit before main, main stiil will be called first.
public functions called when an event happens. OnGameModeInit calls when the game mode loaded.
Reply
#10

Main is called AFTER OnGameModeInit.

pawn Код:
#include <a_samp>

main()
{
    print("MAIN");
}

public OnGameModeInit()
{
    print("INIT");
    return 1;
}
Its not the same as main in c++.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)