New Plugin: VIPMode
by dogan and zacade. FOR REAL
This commit is contained in:
parent
1771e00ec3
commit
64b8b78b75
113
VIPMode/scripting/VIPMode.sp
Normal file
113
VIPMode/scripting/VIPMode.sp
Normal file
@ -0,0 +1,113 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <multicolors>
|
||||
#include <zombiereloaded>
|
||||
|
||||
int g_iVIPClient = -1;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "VIP Mode",
|
||||
author = "Dogan + zaCade",
|
||||
description = "VIP Mode from Paranoid as Plugin",
|
||||
version = "0.1",
|
||||
url = ""
|
||||
};
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
HookEvent("player_death", OnPlayerDeath);
|
||||
HookEvent("round_start", OnRoundStart);
|
||||
HookEvent("round_end", OnRoundEnd);
|
||||
|
||||
RegConsoleCmd("sm_currentvip", WhoIsVIP);
|
||||
}
|
||||
|
||||
public Action WhoIsVIP(int client, int args)
|
||||
{
|
||||
if (g_iVIPClient == -1)
|
||||
{
|
||||
CReplyToCommand(client, "{purple}VIP Mode:{red} There currently is no VIP!");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else
|
||||
{
|
||||
CReplyToCommand(client, "{purple}VIP Mode:{red} %N is the current VIP! Protect him.", g_iVIPClient);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
|
||||
public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
g_iVIPClient = -1;
|
||||
CreateTimer(30.0, SelectVIP, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
public Action OnRoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
g_iVIPClient = -1;
|
||||
}
|
||||
|
||||
public Action SelectVIP(Handle timer)
|
||||
{
|
||||
PerformVIPSelection(false);
|
||||
}
|
||||
|
||||
public void PerformVIPSelection(bool reselect)
|
||||
{
|
||||
int PotentialVIPCount;
|
||||
int PotentialVIPClient[64];
|
||||
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (IsClientInGame(client) && IsPlayerAlive(client) && ZR_IsClientHuman(client))
|
||||
{
|
||||
PotentialVIPClient[PotentialVIPCount] = client;
|
||||
PotentialVIPCount++;
|
||||
}
|
||||
}
|
||||
|
||||
g_iVIPClient = PotentialVIPClient[GetRandomInt(0, PotentialVIPCount - 1)];
|
||||
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} %N is the new VIP! Protect him.", g_iVIPClient);
|
||||
|
||||
if (!reselect)
|
||||
{
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} Everyone will die when the VIP dies!");
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} Everyone will die when the VIP dies!");
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} Everyone will die when the VIP dies!");
|
||||
}
|
||||
}
|
||||
|
||||
public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
int client = GetClientOfUserId(GetEventInt(event, "userid"));
|
||||
|
||||
if(client == g_iVIPClient)
|
||||
{
|
||||
g_iVIPClient = -1;
|
||||
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} The VIP died! It's over.");
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} The VIP died! It's over.");
|
||||
CPrintToChatAll("{purple}VIP Mode:{red} The VIP died! It's over.");
|
||||
|
||||
for (int player = 1; player <= MaxClients; player++)
|
||||
{
|
||||
if (IsClientInGame(player) && IsPlayerAlive(player) && ZR_IsClientHuman(player))
|
||||
{
|
||||
ForcePlayerSuicide(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
if(client == g_iVIPClient)
|
||||
{
|
||||
g_iVIPClient = -1;
|
||||
PerformVIPSelection(true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user