Raised This Month: $32 Target: $400
 8% 

H-Reserved (Advanced Reserved Slots)


Post New Thread Reply   
 
Thread Tools Display Modes
wawazy
Member
Join Date: Aug 2009
Old 10-02-2010 , 12:08   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #521

When i add this plugin

redirector.smx

Quote:
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "1.2.0.0"
public Plugin:myinfo =
{
name = "Server Redirector",
author = "Wazz",
description = "Uses server slots to redirect players to another server",
version = PLUGIN_VERSION,
};
new Handle:Visiblemaxplayers;
new Handle:sm_redirect_slots;
new Handle:sm_redirect_server;
new Handle:sm_redirect_announce;
new Handle:sm_redirect_time;
new String:message[120] = "\x04This server is full. Please press F3 to be redirected to our second server or you will be kicked.\x01";
public OnPluginStart()
{
Visiblemaxplayers = FindConVar("sv_visiblemaxplayers");

sm_redirect_announce = CreateConVar("sm_redirect_announce", "1", "Announces when the server redirects a player", 0, true, 0.0);
sm_redirect_server = CreateConVar("sm_redirect_server", "127.0.0.1:27050", "IP of the server to redirect to.", 0, true, 0.0);
sm_redirect_slots = CreateConVar("sm_redirect_slots", "2", "Number of slots to use for redirecting players.", 0, true, 0.0);
sm_redirect_time = CreateConVar("sm_redirect_time", "35", "Time until a player in a redirect slot is kicked.", 0, true, 0.0);

CreateConVar("sm_redirect_version", PLUGIN_VERSION, "Server Redirector version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY|FCVAR_DONTRECORD);

HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Pre);
}
public OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
new limit = getLimit();

if (client > limit)
{
ChangeClientTeam(client, 1);
}
}
public OnClientPostAdminCheck(client)
{
new String:serverIP[128];
GetConVarString(sm_redirect_server, serverIP, sizeof(serverIP));
new limit = getLimit();
if ((client > limit) && (StrContains(serverIP, "127.0.0.1") == -1))
{
CreateTimer(2.0, VGUITimer, client, TIMER_REPEAT);

PrintToChat(client, message);
PrintCenterText(client, message);
ChangeClientTeam(client, 1);

new String:time[64];
GetConVarString(sm_redirect_time, time, 64);
new Handle:kv = CreateKeyValues("msg");
KvSetString(kv, "time", time);
KvSetString(kv, "title", serverIP);
CreateDialog(client, kv, DialogType_AskConnect);
CreateTimer(5.0, MessageTimer, client, TIMER_REPEAT);
CreateTimer(GetConVarFloat(sm_redirect_time), KickTimer, client);
}
}
public Action:VGUITimer(Handle:timer, any:client)
{
static c = 0;

if (!client || !IsClientInGame(client))
{
c = 0;
return Plugin_Stop;
}
ShowVGUIPanel(client, "info", _, false);
ShowVGUIPanel(client, "team", _, false);
ShowVGUIPanel(client, "active", _, false);
c++;

if (c == (GetConVarInt(sm_redirect_time) / 2))
{
c = 0;
return Plugin_Stop;
}

return Plugin_Continue;
}

public Action:MessageTimer(Handle:timer, any:client)
{
static i = 0;

if (!client || !IsClientInGame(client))
{
i = 0;
return Plugin_Stop;
}

PrintToChat(client, message);
PrintCenterText(client, message);
i++;

if (i == 6)
{
i = 0;
return Plugin_Stop;
}

return Plugin_Continue;
}
public Action:KickTimer(Handle:timer, any:client)
{
decl String:serverIP[128];
GetConVarString(sm_redirect_server, serverIP, sizeof(serverIP));
new limit = getLimit();

if (!client || !IsClientInGame(client))
{
LogMessage( "Client was redirected to %s.", serverIP );
if (GetConVarBool(sm_redirect_announce))
{
PrintToChatAll("x01Player was redirected to \x04%s\x01.", client, serverIP);
}
return Plugin_Handled;
}

if (client > limit)
{

LogMessage( "\"%L\" was offered redirect and did not accept.", client, serverIP );
if (GetConVarBool(sm_redirect_announce))
{
PrintToChatAll("\x04%N \x01did not accept redirect. Please accept to allow for expansion.", client);
}
}

return Plugin_Handled;
}
getLimit()
{
new visibleSlots;
if (Visiblemaxplayers==INVALID_HANDLE || GetConVarInt(Visiblemaxplayers)==-1)
{
visibleSlots = GetMaxClients();
}
else
{
visibleSlots = GetConVarInt(Visiblemaxplayers);
}

new redirectSlots = GetConVarInt(sm_redirect_slots);
new limit = visibleSlots - redirectSlots;

return limit;
}
its work but kick VIP and i dont want that

wa
wawazy is offline
wawazy
Member
Join Date: Aug 2009
Old 10-13-2010 , 23:12   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #522

Somone got any idea ??

wa
wawazy is offline
br5dy
AlliedModders Donor
Join Date: Aug 2008
Old 02-07-2011 , 06:44   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #523

Hello! Thanks for the plugin, but for some reason it's not working on my server.

Here's my hreserved_slots.cfg

Code:
sm_hreserved_admin_protection "1"
sm_hreserved_bot_protection "0"
sm_hreserved_drop_method "0"
sm_hreserved_drop_select "0"
sm_hreserved_immunity_decrement "1"
sm_hreserved_redirect_target ""
sm_hreserved_redirect_timer "12"
sm_hreserved_slots_amount "4"
sm_hreserved_slots_enable "1"
sm_hreserved_use_immunity "1"
sv_visiblemaxplayers 24
I have 4 reserved slots, and am running a 28 slot server, so with the above config it should show x/24 players, with 4 extra reserve slots so if my admins connect it'll show 25/24, 26/24, 27/24, or 28/24. Right? It currently shows x/28.

Thanks.
br5dy is offline
red!
Senior Member
Join Date: Sep 2007
Location: Germany
Old 02-12-2011 , 16:51   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #524

Yes, it should show x/24 when sv_visiblemaxplayer is set to 24, but that's not a feature of my plugin but a game engine thing. the plugin only restricts slots 25-28 from being used by non-admins.

maybe you should sheck out if sv_visiblemaxplayers is overridden from somewhere else in your config (read out the variable by console) or if it is not supported by the game you are running.
red! is offline
living computer
Junior Member
Join Date: Mar 2011
Old 05-04-2011 , 08:24   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #525

i know reserved slots are the a flag by default
but can you tell me the overrides name for this plugin
beacuse i dont wanna give my admins any flags i just overiddes commands to them

i dont do that but i just wanted to test a thing

Last edited by living computer; 10-11-2011 at 10:13. Reason: clarification
living computer is offline
teamafia88
Senior Member
Join Date: Jul 2010
Old 05-09-2011 , 15:23   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #526

hi ,

I have a 16 slot server , I would like my server hosting the 16 players
and only when one of the admins back, a player is kicked .

sorry for my bad English
teamafia88 is offline
SyNiK4L
Junior Member
Join Date: May 2011
Location: Tennessee
Old 05-27-2011 , 19:01   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #527

does this work for l4d2?

EDIT: well i found out it does work for l4d2....but my question is how do i set it up so that all 4 public slots can be filled if no admins are there...but if an admin joins it kicks one of the 4 public players...the only thing iv been able to do is get it to reserve the 4th slot...therefore not allowing anyone to be in that slot unless its an admin....cus basically i want it so if theres 4 pubbers in there and 3 of us admins join....it'll kick 3 ppl and leave the last pubber

Last edited by SyNiK4L; 05-28-2011 at 01:27.
SyNiK4L is offline
Laplace
SourceMod Donor
Join Date: Aug 2010
Location: Germany
Old 05-28-2011 , 06:27   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #528

Very nice plugin, thx for it.
Only one thing - can you add a log entry when a player has been redirected?

Best Regards
Laplace
Laplace is offline
Send a message via ICQ to Laplace
Mike_BoG
SourceMod Donor
Join Date: Jul 2011
Old 07-15-2011 , 12:27   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #529

How would I go on using this to make it so that there is 24 slots and when an admin (or a flag holder) joins the server one gets kicked?
Mike_BoG is offline
Heniek
New Member
Join Date: Jul 2011
Old 07-22-2011 , 10:40   Re: H-Reserved (Advanced Reserved Slots)
Reply With Quote #530

I'm new so hi all! I have a problem. I don't quite know how this plugin works yet. I hope you can help me.

My server has 27 slots, all are visible. I want to have only 1 slot reserved so 26 would be for all players and 1 for admin who is currently joining the server (some kind of buffer if you know what i mean). I added the plugin and waited for the server to get full. I was expecting to see only 26/27 players but it was 27/27 for a long time. One slot was supposed to be free but it wasn't. That time on the server there were 3-4 other admins.

This is my config:
Code:
// ConVars for plugin "hreserved_slots.smx"



// protect admins from beeing dropped from server by reserved slot access (0: no protection, 1: except spec mode, 2: full protection)
// -
// Default: "1"
sm_hreserved_admin_protection "2"

// kick bots/fake clients (e.g. SourceTV)? (0: kick, 1:  do not kick)
// -
// Default: "0"
sm_hreserved_bot_protection "0"

// method for dropping players to free a reserved slot (0: no players are dropped from server, 1: kick, 2: offer to be redirected to the server specified in sm_hreserved_redirect_target)
// -
// Default: "1"
sm_hreserved_drop_method "1"

// select how players are chosen to be dropped from server when there are multiple targets with the same priority. (0: highest ping, 1: shortest connection time)
// -
// Default: "0"
sm_hreserved_drop_select "0"

// value to be subtracted from the immunity level of spectators. The value 0 will make spectators to be treated like players in the game
// -
// Default: "1"
sm_hreserved_immunity_decrement "1"

// alternate server a client is offered to be redirected to, if sm_hreserved_drop_method is set to value 2
// -
// Default: ""
sm_hreserved_redirect_target ""

// time to show the redirection offer dialog
// -
// Default: "12"
sm_hreserved_redirect_timer "12"

// number of reserved slots (do not specify or set to -1 to automatically use hidden slots as reserved)
// -
// Default: "-1"
sm_hreserved_slots_amount "1"

// disable/enable reserved slots
// -
// Default: "1"
sm_hreserved_slots_enable "1"

// use sourcemod immunity level to find a player to be dropped (0: do not use immunity , 1: use immunity level)
// -
// Default: "1"
sm_hreserved_use_immunity "0"

Last edited by Heniek; 07-22-2011 at 11:39.
Heniek is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode