Restricts healer, until a certain amount of players are in the server. 8 players or more enables 1 healer; 12 players or more, enables 2 healers; 18 or more, 3 healers.
Class limits are synced with clients when it changes. Current healers won't get kicked out of their class if the class limit decreases.
This is a plugin for server hosts. It won't do anything if you use the plugin and join a server.
If you host a server and want to use this plugin, download the attached gml file and put it into your Plugins folder.
// Restricts healer, until a certain amount of players are in the server.
// 8 players or more enables 1 healer
// 12 players or more enables 2 healers
// 18 players or more enables 3 healers
// YB, 2018
// Everyone is allowed to modify or republish this plugin freely
globalvar dynamicMedicLimit;
dynamicMedicLimit = id;
ONE_MED_FROM = 8
TWO_MEDS_FROM = 12
THREE_MEDS_FROM = 18
controller = object_add();
object_set_persistent(controller, true);
object_event_add(PlayerControl, ev_create, 0, '
if (global.isHost) {
instance_create(0,0,dynamicMedicLimit.controller);
}
');
object_event_add(PlayerControl, ev_destroy, 0, '
with(dynamicMedicLimit.controller) {
instance_destroy();
}
');
object_event_add(controller, ev_step, ev_step_end, '
var new, current, nbPlayers;
nbPlayers = ds_list_size(global.players) - global.dedicatedMode;
current = global.classlimits[CLASS_MEDIC];
new = 0;
if (nbPlayers >= dynamicMedicLimit.ONE_MED_FROM) {
new = 1;
}
if (nbPlayers >= dynamicMedicLimit.TWO_MEDS_FROM) {
new = 2;
}
if (nbPlayers >= dynamicMedicLimit.THREE_MEDS_FROM) {
new = 3;
}
// update if changed
if (new != current) {
global.classlimits[CLASS_MEDIC] = new;
serializeState(FULL_UPDATE, global.sendBuffer);
}
');