-
Notifications
You must be signed in to change notification settings - Fork 0
/
exampleFSorGM.pwn
56 lines (41 loc) · 1.07 KB
/
exampleFSorGM.pwn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//Example for using script_compatiblity.inc
#include <a_samp>
#include <script_compatibility>
//No need to check for defines!
//You can also run this as a gamemode without using main()
public OnScriptInit() {
printf("Running as : %s", (GetInitMode() == SCRIPT_MODE_FS) ? ("FS") : ("GM"));
//Hooking is necessary in case if this is an include.
#if defined yourLIB_OnIncInit
return yourLIB_OnIncInit();
#else
return 1;
#endif
}
public OnScriptExit() {
printf("Exiting as : %s", (GetInitMode() == SCRIPT_MODE_FS) ? ("FS") : ("GM"));
//Hooking is necessary if this is an include.
#if defined yourLIB_OnIncExit
return yourLIB_OnIncExit();
#else
return 1;
#endif
}
#if defined _ALS_OnScriptInit
#undef OnScriptInit
#else
#define _ALS_OnScriptInit
#endif
#if defined _ALS_OnScriptExit
#undef OnScriptExit
#else
#define _ALS_OnScriptExit
#endif
#define OnScriptInit yourLIB_OnIncInit
#define OnScriptExit yourLIB_OnIncExit
#if defined yourLIB_OnIncInit
forward yourLIB_OnIncInit();
#endif
#if defined yourLIB_OnIncExit
forward yourLIB_OnIncExit();
#endif