Sunucu tanitimi

Load without CSB Credits Shop #1

Merged Daemon666 merged 1 commits from daemon-patch-1 into main
1 changed file with 22 additions and 3 deletions
+22 -3 addons/amxmodx/scripting/csb_daily_top.sma M
@@ -19,7 +19,8 @@
19 19 #include <amxmodx>
20 20 #include <nvault>
21 21
22 -/* provided by CSB Credits Shop; called only when that plugin is loaded */
22 +/* provided by CSB Credits Shop; optional: the native filter below lets the
23 + plugin load without it, and the reward is skipped when it is missing */
23 24 native csb_add_credits(id, amount);
24 25
25 26 new const PLUGIN[] = "CSB Daily Top"
@@ -29,6 +30,24 @@ new const AUTHOR[] = "counter-strike-boost.com"
29 30 new g_iKills[33]
30 31 new g_iVault
31 32 new g_pReward
33 +new bool:g_bHasCredits = true
34 +
35 +public plugin_natives()
36 +{
37 + set_native_filter("nativeFilter")
38 +}
39 +
40 +/* Called at load for every native no plugin or module provides */
41 +public nativeFilter(const name[], index, trap)
42 +{
43 + if (!trap && equal(name, "csb_add_credits"))
44 + {
45 + g_bHasCredits = false
46 + return PLUGIN_HANDLED
47 + }
48 +
49 + return PLUGIN_CONTINUE
50 +}
32 51
33 52 public plugin_init()
34 53 {
@@ -58,7 +77,7 @@ public client_putinserver(id)
58 77 loadPlayer(id)
59 78 }
60 79
61 -public client_disconnect(id)
80 +public client_disconnected(id)
62 81 {
63 82 savePlayer(id)
64 83 }
@@ -145,7 +164,7 @@ announceTop()
145 164 /* hand the winner a credit reward if the shop is installed */
146 165 new reward = get_pcvar_num(g_pReward)
147 166
148 - if (reward > 0 && is_plugin_loaded("csb_credits_shop.amxx", true) != -1)
167 + if (reward > 0 && g_bHasCredits)
149 168 {
150 169 csb_add_credits(ids[0], reward)
151 170
152 171