Skip to content

Commit 0898b33

Browse files
RankRestrictions: Implemented new ranking systems (#261)
* Implemented new ranking systems - CMSStats MySQL - CSstatsX SQL - CSStats MySQL - CSX Module * Added csx's forward to native filter * Fix indentation * Update cstrike/addons/amxmodx/configs/plugins/ChatAdditions/CA_Addon_RankRestrictions.cfg Co-authored-by: Sergey Shorokhov <[email protected]>
1 parent 0c11e31 commit 0898b33

File tree

2 files changed

+74
-10
lines changed

2 files changed

+74
-10
lines changed

cstrike/addons/amxmodx/configs/plugins/ChatAdditions/CA_Addon_RankRestrictions.cfg

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ ca_rankrestrictions_min_kills "10"
2323
// 1 - Army Ranks Ultimate
2424
// 2 - OciXCrom's Rank System
2525
// 3 - CMSStats Ranks
26+
// 4 - CMSStats MySQL
27+
// 5 - CSstatsX SQL
28+
// 6 - CSX Module
2629
// -
2730
// Default: "1"
2831
// Minimum: "0.000000"
29-
// Maximum: "3.000000"
32+
// Maximum: "6.000000"
3033
ca_rankrestrictions_type_level "1"
3134

3235
// Min Level to access voice & text chat
@@ -41,3 +44,11 @@ ca_rankrestrictions_min_level "2"
4144
ca_rankrestrictions_immunity_flag "a"
4245

4346

47+
// Kill System Types
48+
// 0 - CSStats MySQL
49+
// 1 - CSX Module
50+
// -
51+
// Default: "0"
52+
// Minimum: "0.000000"
53+
// Maximum: "1.000000"
54+
ca_rankrestrictions_type_kills "0"

cstrike/addons/amxmodx/scripting/CA_Addon_RankRestrictions.sma

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ native ar_get_user_level(const player, rankName[] = "", len = 0)
99
native crxranks_get_user_level(const player)
1010
native cmsranks_get_user_level(id, szLevel[] = "", len = 0)
1111
native csstats_get_user_stats(const player, const stats[22])
12+
native Float:cmsstats_get_user_skill(index, skillname[] = "", namelen = 0, &skill_level = 0);
13+
native get_user_skill(player,&Float:skill)
14+
native get_user_stats(index,stats[STATSX_MAX_STATS],bodyhits[MAX_BODYHITS]);
1215
//
1316

1417

1518
static ca_rankrestrictions_type,
1619
ca_rankrestrictions_min_kills,
1720
ca_rankrestrictions_type_level,
1821
ca_rankrestrictions_min_level,
19-
ca_rankrestrictions_immunity_flag[16]
22+
ca_rankrestrictions_immunity_flag[16],
23+
ca_rankrestrictions_type_kills
2024

2125
public stock const PluginName[] = "CA Addon: Rank restrictions"
2226
public stock const PluginVersion[] = CA_VERSION
@@ -53,6 +57,12 @@ public native_filter(const name[], index, trap) {
5357
if(strcmp(name, "cmsranks_get_user_level"))
5458
return PLUGIN_HANDLED;
5559

60+
if(strcmp(name, "cmsstats_get_user_skill"))
61+
return PLUGIN_HANDLED;
62+
63+
if(strcmp(name, "get_user_stats"))
64+
return PLUGIN_HANDLED;
65+
5666
return PLUGIN_CONTINUE
5767
}
5868

@@ -78,9 +88,12 @@ static Register_CVars() {
7888
0 - Advanced Experience System\n\
7989
1 - Army Ranks Ultimate\n\
8090
2 - OciXCrom's Rank System\n\
81-
3 - CMSStats Ranks",
91+
3 - CMSStats Ranks\n\
92+
4 - CMSStats MySQL\n\
93+
5 - CSstatsX SQL\n\
94+
6 - CSX Module",
8295
.has_min = true, .min_val = 0.0,
83-
.has_max = true, .max_val = 3.0
96+
.has_max = true, .max_val = 6.0
8497
), ca_rankrestrictions_type_level
8598
)
8699

@@ -95,6 +108,15 @@ static Register_CVars() {
95108
),
96109
ca_rankrestrictions_immunity_flag, charsmax(ca_rankrestrictions_immunity_flag)
97110
)
111+
112+
bind_pcvar_num(create_cvar("ca_rankrestrictions_type_kills", "1",
113+
.description = "Kill System Types\n\
114+
0 - CSStats MySQL\n\
115+
1 - CSX Module",
116+
.has_min = true, .min_val = 0.0,
117+
.has_max = true, .max_val = 1.0
118+
), ca_rankrestrictions_type_kills
119+
)
98120
}
99121

100122
public CA_Client_Say(player) {
@@ -155,16 +177,47 @@ static GetUserLevel(const player) {
155177
case 1: return ar_get_user_level(player)
156178
case 2: return crxranks_get_user_level(player)
157179
case 3: return cmsranks_get_user_level(player)
180+
case 4:
181+
{
182+
new iSkill
183+
cmsstats_get_user_skill(player, .skill_level = iSkill)
184+
return iSkill
185+
}
186+
case 5:
187+
{
188+
new Float:iSkill
189+
get_user_skill(player, iSkill)
190+
return floatround(iSkill)
191+
}
192+
case 6:
193+
{
194+
new iStats[STATSX_MAX_STATS], iHits[MAX_BODYHITS]
195+
get_user_stats(player, iStats, iHits)
196+
return iStats[STATSX_RANK]
197+
}
158198
}
159199

160200
return 0
161201
}
162202

163203
static GetUserFragsFromStats(const player) {
164-
enum { stats_Frags/* , stats_Deaths, stats_Rounds = 16 */ }
165-
166-
new stats[22]
167-
csstats_get_user_stats(player, stats)
168-
169-
return stats[stats_Frags]
204+
enum { stats_Frags/* , stats_Deaths, stats_Rounds = 16 */ }
205+
206+
switch(ca_rankrestrictions_type_kills)
207+
{
208+
case 0:
209+
{
210+
new stats[22]
211+
csstats_get_user_stats(player, stats)
212+
return stats[stats_Frags]
213+
}
214+
case 1:
215+
{
216+
new iStats[STATSX_MAX_STATS], iHits[MAX_BODYHITS]
217+
get_user_stats(player, iStats, iHits)
218+
return iStats[STATSX_KILLS]
219+
}
220+
}
221+
222+
return 0
170223
}

0 commit comments

Comments
 (0)