Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Fuzzy168 on November 13, 2011, 08:32:17 am
-
How do i create Includes???
-
Here's how to write a C style include. Create a file named test.h inside include folder. Add this code inside the file:
#if defined Test_H // Checks if the Test_H macro is defined
#endif // Ends if the file was attempted of being included twice
#define Test_H // Defines the Test_H macro
public TestFunc() {
printf("TestFunct has been found o:");
}
Inside the main code add:
#include <test.h>
Now try calling the function and see how it goes. Cheers :P
-
Slight correction:
[pawn]
#if defined Test_H // Checks if the Test_H macro is defined
#endif // Ends if the file was attempted of being included twice
[/pawn]
Should be
[pawn]
#if defined Test_H // Checks if the Test_H macro is defined
#endinput // Stop if the file was included before
#endif
[/pawn]
Everything else looks good.
-
Ups. Forgot that pawn uses slightly different rules of macrology ???
-
If i create an include name test.inc its still the same right?
-
If i create an include name test.inc its still the same right?
Yup. But when loading .inc files use:
[pawn]#include <test>[/pawn]
-
Ok thanks...