View Full Version : 1 sniper
mateocjs
16th May 2021, 23:45
How can I make there is only one sniper per team?
example: axis only a kar98ksniper and if a player select the sniper (in addition to the one who already has it) be assigned another weapon (kar98k)
Thanksss
maxdamage99
17th May 2021, 09:06
a lot of nuances, mode and so on, how people choose weapons, once or each (as an example).
default _weapons.gsc:
restrictWeaponByServerCvars(response)
{
SNIPER_LIMIT = 1;
if (!isDefined(level.snipers_list))
level.snipers_list = [];
if (!isDefined(level.snipers_list[self.pers["team"]]))
level.snipers_list[self.pers["team"]] = 0;
if (!isDefined(self.isSniper))
self.isSniper = false;
/* other code */
case "kar98k_sniper_mp":
if(!getcvarint("scr_allow_kar98ksniper") || (level.snipers_list[self.pers["team"]] > SNIPER_LIMIT && !self.isSniper))
response = "restricted";
else
{
level.snipers_list[self.pers["team"]]++;
self.isSniper = true;
}
break;
/* other code */
if (response != "restricted" && response != "kar98k_sniper_mp" && self.isSniper)
{
level.snipers_list[self.pers["team"]]--;
self.isSniper = false;
}
/* other code */
}
codecallback_playerDisconnect()
{
/* other code */
if (self.isSniper)
level.snipers_list[self.pers["team"]]--;
/* other code */
}
IzNoGoD
17th May 2021, 18:09
Dont forget to clean up the list upon sniper joining spec and/or on sniper joining other team/autobalance.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.