RSSy MYGO.pl Opublikowano Wrzesień 6, 2020 o 16:59 RSSy Udostępnij Opublikowano Wrzesień 6, 2020 o 16:59 Description This plugins is allowing VIP (clients with the reservation flag) to join a full server, it will kick the client that was last connected to the server. However, if an Admin (clients with the ban flag) joins, it will allow them in but not kick the last connected client. This plugin is made for 5v5 servers with 11 slots, check out the Modifications tab how to configure the plugin for your server! Installation Download the CustomReservedslots.smx file Put it in your plugins folder (/addons/sourcemod/plugins/) Delete the default reserved slot plugin file (/addons/sourcemod/plugins/reservedslots.smx) Either change map or run "sm_rcon sm plugins refresh" in your console (to load the plugin) The plugin is now loaded and working Modifications Spoiler This plugin is mainly made for 5v5 servers with 11 slots. If your server has more/less slots, you have to change the MAX_SERVER_SLOTS value. To do that, go to line 10 and change the value from 11 to whatever amount of slots you have on your server. PHP Code: #define MAX_SERVER_SLOTS 11 Code Spoiler PHP Code: #include <sourcemod> #include <PTaH> #pragma newdecls required #pragma semicolon 1 #pragma tabsize 0 #define LoopValidClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++) if(IsValidClient(%1)) #define MAX_SERVER_SLOTS 11 public Plugin myinfo = { name = "CustomReservedslots", author = "Trum", description = "Allow VIP & Admins to join full servers, kick normal players to let a free slot for VIP", version = "1.0", url = "" } public void OnClientPostAdminCheck(int client) { int iPlayers = 0; LoopValidClients(i) iPlayers++; if(iPlayers >= MAX_SERVER_SLOTS) { if(!IsValidClient(client)) return; if(!CheckCommandAccess(client, "", ADMFLAG_RESERVATION, true) && !CheckCommandAccess(client, "", ADMFLAG_BAN, true)) { CreateTimer(0.1, OnTimedKickForReject, GetClientUserId(client)); } else if(CheckCommandAccess(client, "", ADMFLAG_RESERVATION, true)) { int time = 0x7fffffff; int lastConnectedClient; for(int i = 1; i <= MaxClients; i++) { if(IsValidClient(i) && !CheckCommandAccess(i, "", ADMFLAG_RESERVATION, true) && !CheckCommandAccess(i, "", ADMFLAG_BAN, true)) { if(time > GetClientTime(i)) { time = GetClientTime(i); lastConnectedClient = i; } } } if(!CheckCommandAccess(client, "", ADMFLAG_BAN, true)) KickClient(lastConnectedClient, "You have been kicked because a VIP joined.\n\nPurchase VIP to get access to full servers!\n\nStore: www.store.turf.gg"); } } } public Action OnTimedKickForReject(Handle timer, any userid) { int client = GetClientOfUserId(userid); if(!client || !IsClientInGame(client)) return Plugin_Handled; KickClient(client, "%s", "This server is full.\n\nPurchase VIP to get access to full servers!\n\nStore: www.store.turf.gg"); return Plugin_Handled; } public bool IsValidClient(int client) { return ((0 < client <= MaxClients) && IsClientInGame(client) && !IsFakeClient(client)); } Changelog Code: 1.0 - 2020.09.06 First release Credits Scag - for the last connected client method Wyświetl pełny artykuł Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi