Load without the CSB rank plugin #1
Merged
Daemon666 merged 1 commits from
daemon-patch-1
into main
1 changed file
with 20 additions and 3 deletions
addons/amxmodx/scripting/csb_rank_badges.sma
M
| @@ -19,7 +19,8 @@ | ||
| 19 | 19 | |
| 20 | 20 | #include <amxmodx> |
| 21 | 21 | |
| 22 | -/* provided by the CSB rank plugin; only called when it is loaded */ | |
| 22 | +/* provided by the CSB rank plugin; optional: the native filter below lets the | |
| 23 | + plugin load without it, and badges then use frags */ | |
| 23 | 24 | native csb_get_rank_score(id); |
| 24 | 25 | |
| 25 | 26 | new const PLUGIN[] = "CSB Rank Badges" |
| @@ -32,7 +33,24 @@ new g_iTierScore[MAX_TIERS] | ||
| 32 | 33 | new g_szTierName[MAX_TIERS][24] |
| 33 | 34 | new g_iTiers |
| 34 | 35 | |
| 35 | -new bool:g_bRankPlugin | |
| 36 | +new bool:g_bRankPlugin = true | |
| 37 | + | |
| 38 | +public plugin_natives() | |
| 39 | +{ | |
| 40 | + set_native_filter("nativeFilter") | |
| 41 | +} | |
| 42 | + | |
| 43 | +/* Called at load for every native no plugin or module provides */ | |
| 44 | +public nativeFilter(const name[], index, trap) | |
| 45 | +{ | |
| 46 | + if (!trap && equal(name, "csb_get_rank_score")) | |
| 47 | + { | |
| 48 | + g_bRankPlugin = false | |
| 49 | + return PLUGIN_HANDLED | |
| 50 | + } | |
| 51 | + | |
| 52 | + return PLUGIN_CONTINUE | |
| 53 | +} | |
| 36 | 54 | |
| 37 | 55 | public plugin_init() |
| 38 | 56 | { |
| @@ -44,7 +62,6 @@ public plugin_init() | ||
| 44 | 62 | register_clcmd("say_team", "hookSayTeam") |
| 45 | 63 | |
| 46 | 64 | loadTiers() |
| 47 | - g_bRankPlugin = (is_plugin_loaded("csb_rank.amxx", true) != -1) | |
| 48 | 65 | } |
| 49 | 66 | |
| 50 | 67 | public client_putinserver(id) |
| 51 | 68 |









