Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Releases & Resources
  3. [Release][MP] Slots limiter by class

[Release][MP] Slots limiter by class

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
10 Posts 4 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • LeonFullundefined Offline
    LeonFullundefined Offline
    LeonFull
    wrote on last edited by LeonFull
    #1

    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

    https://github.com/viniciusmdev/Slots-limiter-by-class/releases/download/1.1/copy_to_iw4mAdmin_folder.rar

    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.gsc

    Source code:
    https://github.com/viniciusmdev/Slots-limiter-by-class/blob/main/_clientids_not_compiled.gsc

    I 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.

    https://www.youtube.com/watch?v=0xnyGlV6KIk

    Xerxesundefined 1 Reply Last reply
    1
    • birchyundefined Offline
      birchyundefined Offline
      birchy
      wrote on last edited by birchy
      #2

      for the sake of completeness

      classCheck () {
        for (class = 0; class < 10; class++) {
          if (self getLoadoutAllocation(class) > level.maxAllocation) {
            //Log, etc.
            kick(self getEntityNumber());
            break;
          }
        }
      }
      LeonFullundefined 1 Reply Last reply
      3
      • birchyundefined birchy

        for the sake of completeness

        classCheck () {
          for (class = 0; class < 10; class++) {
            if (self getLoadoutAllocation(class) > level.maxAllocation) {
              //Log, etc.
              kick(self getEntityNumber());
              break;
            }
          }
        }
        LeonFullundefined Offline
        LeonFullundefined Offline
        LeonFull
        wrote on last edited by
        #3

        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.

        birchyundefined 1 Reply Last reply
        2
        • Migter12undefined Offline
          Migter12undefined Offline
          Migter12
          wrote on last edited by
          #4

          never heard of the command
          what does it do?

          LeonFullundefined 1 Reply Last reply
          0
          • LeonFullundefined LeonFull

            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

            https://github.com/viniciusmdev/Slots-limiter-by-class/releases/download/1.1/copy_to_iw4mAdmin_folder.rar

            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.gsc

            Source code:
            https://github.com/viniciusmdev/Slots-limiter-by-class/blob/main/_clientids_not_compiled.gsc

            I 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.

            https://www.youtube.com/watch?v=0xnyGlV6KIk

            Xerxesundefined Offline
            Xerxesundefined Offline
            Xerxes
            Plutonium Staff
            wrote on last edited by
            #5

            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?

            LeonFullundefined 1 Reply Last reply
            0
            • Xerxesundefined Xerxes

              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?

              LeonFullundefined Offline
              LeonFullundefined Offline
              LeonFull
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • Migter12undefined Migter12

                never heard of the command
                what does it do?

                LeonFullundefined Offline
                LeonFullundefined Offline
                LeonFull
                wrote on last edited by
                #7

                Migter12 this command causes each class to have more than 10 slots.

                1 Reply Last reply
                0
                • LeonFullundefined LeonFull

                  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.

                  birchyundefined Offline
                  birchyundefined Offline
                  birchy
                  wrote on last edited by birchy
                  #8

                  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).

                  1 Reply Last reply
                  0
                  • LeonFullundefined Offline
                    LeonFullundefined Offline
                    LeonFull
                    wrote on last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • LeonFullundefined Offline
                      LeonFullundefined Offline
                      LeonFull
                      wrote on last edited by
                      #10

                      the script is only starting to work after there is at least one map rotation, does anyone have any idea why?

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Donate