1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "0.1"
new String:g_SaveNextMap[128];
new Handle:g_Switch;
new handle:g_Map = INVALID_HANDLE;
new Handle:g_MinPlayer = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "Empty Server",
author = "Erblast",
description = "",
version = PLUGIN_VERSION,
url = "www.sourcemod.net"
}
public OnMapStart()
{
GetNextMap(g_SaveNextMap, sizeof(g_SaveNextMap));
}
public OnPluginStart()
{
CreateConVar("Empty_Server_version", PLUGIN_VERSION, "Empty_Server_version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
g_Switch = CreateConVar("sm_empty_server","1","1 turns plugin on 0 is off",FCVAR_NOTIFY);
g_Map = CreateConVar("sm_empty_Map", "de_dust2", "Welche Map soll laufen?",FCVAR_NOTIFY);
g_MinPlayer = CreateConVar("sm_empty_minplayer", "4", "Ab wievielen Spieler soll die Map laufen?", 4, true, 0.0, true, 10.0);
HookEvent("round_end", Event_RoundEnd);
AutoExecConfig(true,"EmptyServer");
}
public Event_RoundEnd (Handle:event, const String:name[], bool:dontBroadcast)
{
if(GetConVarInt(g_Switch)==1)
{
new count = 0;
for (new i = 1; i <= MaxClients; i++)
if (IsClientInGame(i) && IsClientConnected(i) && !IsFakeClient(i))
{
count++;
}
if (count <= GetConVarInt(g_MinPlayer))
{
decl String:g_temp[128];
GetConVarString(g_Map, g_temp, sizeof(g_temp));
SetNextMap(g_temp);
}
else if (count > GetConVarInt(g_MinPlayer))
{
SetNextMap(g_SaveNextMap);
}
}
}
|