[Release][MP] Slots limiter by class
-
Guys i created a script that kicks players who use more slots per class than the one determined by cfg. As I searched in various places and I found nothing about it, I decided to post it here. Below is the instructions on how to install on your server.
Call the
player thread maxalloc_block ();
in the onplayerconnect function.onplayerconnect() { for ( ;; ) { level waittill( "connecting", player ); player.clientid = level.clientid; level.clientid++; player thread onplayerspawned(); player thread maxalloc_block(); } }
place the following function anywhere in your script
maxalloc_block() { self endon("disconnect"); level endon("game_ended"); self waittill( "spawned_player" ); level.maxAllocation = getDvarInt("maxAlloc_value"); if(level.maxAlloc_value == " ") SetDvar("maxAlloc_value", 10); level.maxAlloc_enable = getDvarInt("maxAlloc_enable"); if(level.maxAlloc_enable == " ") SetDvar("maxAlloc_enable", 1); for (class = 0; class < 10; class++) { if (self getLoadoutAllocation(class) > level.maxAllocation && level.maxAlloc_enable == 1) { logprint( "ScriptMaxAlloc;" + self getguid() + "\n"); break; } } }
Extract and copy the following file to the iw4mAdmin folder
Set this lines on your cfg file:
set maxAlloc_enable 1 // 1 Enable | 0 Disable - Default 1 set maxAlloc_value 10 // Max value of slots per classe - Default 10
Compiled script file:
https://github.com/viniciusmdev/Slots-limiter-by-class/releases/download/1.1/_clientids.gscSource code:
https://github.com/viniciusmdev/Slots-limiter-by-class/blob/main/_clientids_not_compiled.gscI used the Generic Log Parser plugin to communicate the gsc script with the iw4madmin panel, follow the link
https://forum.awog.at/topic/171/release-generic-log-parser
Here is a video of the script working.
-
for the sake of completeness
classCheck () { for (class = 0; class < 10; class++) { if (self getLoadoutAllocation(class) > level.maxAllocation) { //Log, etc. kick(self getEntityNumber()); break; } } }
-
birchy this is a much easier way to do it, but by integrating the script into the panel you will have information on who was kicked, when and why.
-
never heard of the command
what does it do? -
Nice creative approach, but you do realize that gts is just the alias for the command and they can just the the longer version of the command into the console without any issues, right?
-
Xerxes said in [Release][MP] MaxAllocation command block:
Nice creative approach, but you do realize that gts is just the alias for the command and they can just the the longer version of the command into the console without any issues, right?
didnt' know, what is the entire command? in this case, is just create one more rule for the command without abbreviation, or follow the line of the birchy script but implementing a log.
-
Migter12 this command causes each class to have more than 10 slots.
-
LeonFull hence why I put the comment to indicate you can do logging here if you want to
logprint( "ScriptMaxAlloc;" + self.guid + "\n");
would replace that comment in this case (This approach lets you know which class, if that's of any use).
-
This post is deleted!
-
the script is only starting to work after there is at least one map rotation, does anyone have any idea why?