SA-MP Forums Archive
main() after public functions - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: main() after public functions (/showthread.php?tid=255223)



main() after public functions - GaGlets(R) - 14.05.2011

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


Re: main() after public functions - xRyder - 14.05.2011

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


Re: main() after public functions - Macluawn - 14.05.2011

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


Re: main() after public functions - Joe Staff - 14.05.2011

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


Re: main() after public functions - DRIFT_HUNTER - 14.05.2011

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


Re: main() after public functions - playbox12 - 14.05.2011

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


Re: main() after public functions - Donya - 14.05.2011

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


Re: main() after public functions - Macluawn - 15.05.2011

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()


Re: main() after public functions - xDeadlyBoy - 15.05.2011

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.


Re: main() after public functions - iggy1 - 15.05.2011

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++.