SA-MP Forums Archive
#define and #include - 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: #define and #include (/showthread.php?tid=99571)



#define and #include - Bob the Builder - 28.09.2009

what are #define and #include for, also when i compile a script i downloaded it tells me that it cant read the file "utils" which is one of the #include's it says on line 21 "#include <utils>"

any can help me with these questions it would be much apprieciated!


Re: #define and #include - Desert - 28.09.2009

#include is when you "add" a include to your script look for the dutils include to fix this

#define is when you set example a word a speciffic value like #define TEAM_GROVE 1

Then if you type TEAM_GROVE later it will automaticly change it to 1 when compiled. This can make it alot easier to keep count on lots of teams for a TDM server

Editted: Typo


Re: #define and #include - Bob the Builder - 28.09.2009

okayt thanks i understand #define but i am still a little confused about #include and how i can fix my problem, thanks for the help so far but can you just elaborate on what #include is and how i can fix my problem?

thanks


Re: #define and #include - Nero_3D - 28.09.2009

#include includes another script in your gamemode

Example

main.inc
pawn Код:
main()
{
    print("Main");
}
Gamemode.pwn
pawn Код:
#include <a_samp> //includes a_samp.inc - if it fail it will give you an warning
#tryinclude <main> //try to include main.inc - if it fail nothing will happen

public OnGameModeInit()
{
    AddPlayerClass( 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
}
if you complie your script, it would look something like that in the amx (just converted)

Код:
//samp stuff

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

public OnGameModeInit()
{
	AddPlayerClass( 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
}
How to fix your problem ?
Easy, you need to get the file "utils.inc" (serach for it - ****** helps, too)
And then put it in the include folder (?:\...\sa-mp_server_directory\pawno\include\)


Re: #define and #include - Bob the Builder - 28.09.2009

awesome thank you so much for the help