question on making a simple gsc code for "reserved slots"
-
I could easily make one i think and i have a basic idea but tried and it didnt work. Does anyone else have a idea on this?
Example: 17 players (max but you can still join) and when you join, it finds you have VIP status and after that, it kicks a random player that doesnt have VIP status -
mikzy Untested, but I left some comments that should make it easy to figure out.
hasVipStatus() { /* Conduct your VIP status check here */ return status; } /* Returns bool on whether room was made for the VIP player vip_slots - The amount of VIP slots on the server */ makeVipRoom(vip_slots) { room_made = false; if(level.players.size >= vip_slots) { // If there's as many or more players as there are vip slots, we need to kick someone who isn't vip for(i = 0; i < level.players.size; i++) { // Iterate over each player in the server player = level.players[i]; if(!player isHost() && !player hasVipStatus()) { // If the player isn't host and isn't vip // The iterator index should be the same as the entity number in this case (I think) kick(i); // Kick the non-vip player room_made = true; break; } } } return room_made; }
makeVipRoom()
returns a boolean on whether room was made or not. Maybe you could use it to send an error or something to the player that there's no room available. -
So, for example, the server is full and has 18 players in. Lets say we have it so if you VIP status is found on player joining, it does kick a random player and lets you join. Is that how it would work?
-
mikzy I don't think it's actually possible to-do that cause onPlayerConnect works when the player is actually connecting and it doesn't react when the server is full i believe.
-
I do believe that this could be made in GSC. Depends on how you want to approach it.
I feel like it'd be easy to create one "reserved slot" but it would require you to have one less player available in order to allow players to attempt to connect.
-
Cahz thats what i was thinking
-
What's wrong with IW4MAdmin? It has reserve slots.
-
not really but okay and besides i think i found a fix for the way imma do it now