Parent Directory | Revision Log
Revision 17 - (view) (download)
1 : | ian | 17 | #include <amxmodx> |
2 : | |||
3 : | native Factorial(num) | ||
4 : | |||
5 : | public __Factorial(id, num) | ||
6 : | { | ||
7 : | new num = get_param(1) | ||
8 : | if (num == 0) | ||
9 : | { | ||
10 : | return 1 | ||
11 : | } | ||
12 : | |||
13 : | return num * Factorial(num - 1) | ||
14 : | } | ||
15 : | |||
16 : | public plugin_natives() | ||
17 : | { | ||
18 : | register_native("Factorial", "__Factorial") | ||
19 : | } | ||
20 : | |||
21 : | public plugin_init() | ||
22 : | { | ||
23 : | register_plugin("Native Test", "1.0", "BAILOPAN") | ||
24 : | register_srvcmd("test_native1", "Command_TestNative1") | ||
25 : | } | ||
26 : | |||
27 : | public Command_TestNative1() | ||
28 : | { | ||
29 : | new num = Factorial(6) | ||
30 : | server_print("Factorial of 6 is: %d", num) | ||
31 : | } |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |