Skip to content

Commit 513312f

Browse files
committed
Merge branch 'b-2.5'
2 parents a08eeb9 + 80f9e96 commit 513312f

File tree

5 files changed

+79
-13
lines changed

5 files changed

+79
-13
lines changed

valve/addons/amxmodx/scripting/agmodx.sma

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,9 +1183,23 @@ public FwVoiceSetClientListening(receiver, sender, bool:listen) {
11831183
if (receiver == sender)
11841184
return FMRES_IGNORED;
11851185

1186-
if (gVersusStarted && !get_pcvar_num(gCvarSpecTalk) && hl_get_user_spectator(sender) && !hl_get_user_spectator(receiver)) {
1187-
engfunc(EngFunc_SetClientListening, receiver, sender, false);
1188-
return FMRES_SUPERCEDE;
1186+
if (!is_user_connected(receiver) || !is_user_connected(sender))
1187+
return FMRES_IGNORED;
1188+
1189+
if (gVersusStarted) {
1190+
// Don't allow players who are not in the match to hear players in a match even if ag_spectalk is enabled
1191+
if (RestoreScore_FindPlayer(sender) && !RestoreScore_FindPlayer(receiver)) {
1192+
engfunc(EngFunc_SetClientListening, receiver, sender, false);
1193+
return FMRES_SUPERCEDE;
1194+
}
1195+
1196+
if (!get_pcvar_num(gCvarSpecTalk)) {
1197+
// Don't allow players who are not in the match to speak to players in a match
1198+
if (!RestoreScore_FindPlayer(sender) && RestoreScore_FindPlayer(receiver)) {
1199+
engfunc(EngFunc_SetClientListening, receiver, sender, false);
1200+
return FMRES_SUPERCEDE;
1201+
}
1202+
}
11891203
}
11901204

11911205
return FMRES_IGNORED;
@@ -1195,10 +1209,26 @@ public FwVoiceSetClientListening(receiver, sender, bool:listen) {
11951209
* Location System
11961210
*/
11971211
public LoadLocations() {
1198-
new map[32];
1199-
get_mapname(map, charsmax(map));
1212+
new mapFile[64];
12001213

1201-
new handle = fopen(fmt("locs/%s.loc", map), "r");
1214+
// because fopen is case sensitive, we need to find the .loc file and use his exact name
1215+
// otherwise, files like HAVOC.LOC or HaVoC.LoC will not be read
1216+
{
1217+
new mapName[32];
1218+
get_mapname(mapName, charsmax(mapName));
1219+
1220+
new file[64];
1221+
new handleDir = open_dir("locs", file, charsmax(file));
1222+
do {
1223+
if (equali(file, fmt("%s.loc", mapName))) {
1224+
formatex(mapFile, charsmax(mapFile), "locs/%s", file);
1225+
break;
1226+
}
1227+
} while (next_file(handleDir, file, charsmax(file)));
1228+
close_dir(handleDir);
1229+
}
1230+
1231+
new handle = fopen(mapFile, "r");
12021232

12031233
if (!handle)
12041234
return false;
@@ -1238,6 +1268,8 @@ public LoadLocations() {
12381268
}
12391269
}
12401270

1271+
fclose(handle);
1272+
12411273
return true;
12421274
}
12431275

@@ -2793,7 +2825,7 @@ SetPlayerEquipment(id) {
27932825
}
27942826

27952827
if (get_pcvar_bool(gCvarStartLongJump)) {
2796-
give_item(id, "item_longjump");
2828+
hl_set_user_longjump(id, true);
27972829
}
27982830

27992831
ResetBpAmmo(id);

valve/addons/amxmodx/scripting/agmodx_arcade.sma

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,32 @@ public CmdDrop() {
5151

5252
public OnPlayerKilled_Pre(victim, attacker) {
5353
if (is_user_alive(attacker)) {
54-
set_user_health(attacker, get_pcvar_num(gCvarStartHealth));
55-
set_user_armor(attacker, get_pcvar_num(gCvarStartArmor));
56-
ResetBpAmmo(attacker);
57-
ResetWeaponClip(attacker);
54+
RestorePlayer(attacker); // restore attacker HP/AP and weapons after frag
55+
}
56+
}
57+
58+
RestorePlayer(id) {
59+
set_user_health(id, get_pcvar_num(gCvarStartHealth));
60+
set_user_armor(id, get_pcvar_num(gCvarStartArmor));
61+
62+
RestoreWeapons(id);
63+
ResetBpAmmo(id);
64+
ResetWeaponClip(id);
65+
}
66+
67+
RestoreWeapons(id) {
68+
// these weapons need to be restored in case they have gone from player's inventory
69+
if (!hl_user_has_weapon(id, HLW_SATCHEL) && get_pcvar_num(gCvarStartWeapons[START_SATCHEL])) {
70+
give_item(id, "weapon_satchel");
71+
}
72+
if (!hl_user_has_weapon(id, HLW_HANDGRENADE) && get_pcvar_num(gCvarStartWeapons[START_HGRENADE])) {
73+
give_item(id, "weapon_handgrenade");
74+
}
75+
if (!hl_user_has_weapon(id, HLW_SNARK) && get_pcvar_num(gCvarStartWeapons[START_SNARK])) {
76+
give_item(id, "weapon_snark");
77+
}
78+
if (!hl_user_has_weapon(id, HLW_TRIPMINE) && get_pcvar_num(gCvarStartWeapons[START_TRIPMINE])) {
79+
give_item(id, "weapon_tripmine");
5880
}
5981
}
6082

valve/addons/amxmodx/scripting/agmodx_ctf.sma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ ParseEntFromFile(const input[], ent_name[], len, Float:ent_origin[3], Float:ent_
214214
}
215215

216216
public plugin_init() {
217-
register_dictionary("agmodxctf.txt");
217+
register_dictionary("agmodx_ctf.txt");
218218

219219
// load always ctf map config file
220220
new bool:result = LoadCtfMapFile();

valve/addons/amxmodx/scripting/include/agmodx_stocks.inc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ stock ResetChargers() {
7474
} else if (equal(classname, "func_healthcharger")) {
7575
set_pev(i, pev_frame, 0);
7676
set_pev(i, pev_nextthink, 0);
77-
set_ent_data(i, "CWallHealth", "m_iJuice", 75);
77+
set_ent_data(i, "CWallHealth", "m_iJuice", get_skill_cvar_num("sk_healthcharger"));
7878
}
7979
}
8080
}
@@ -278,3 +278,15 @@ stock CountSpecs() {
278278
}
279279
return numSpecs;
280280
}
281+
282+
stock get_skill_cvar_string(const name[], output[], len) {
283+
new skill = clamp(get_cvar_num("skill"), 1, 3);
284+
get_cvar_string(fmt("%s%d", name, skill), output, len);
285+
}
286+
287+
288+
stock get_skill_cvar_num(const name[]) {
289+
new value[32];
290+
get_skill_cvar_string(name, value, charsmax(value));
291+
return str_to_num(value);
292+
}

0 commit comments

Comments
 (0)