Not trying to bump or anything but making a new tread on this subject is just being a rudeboy, I've tried making a version of this without the showkey function because its allready in the mod I'm using on the server, it will probably interfer with it and optimizing is very important for me even if it could just be disabled, complies without any errors but doesnt print anything ingame, what did I do wrong?
PHP Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "Clarkey"
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
#define SPECMODE_NONE 0
#define SPECMODE_FIRSTPERSON 4
#define SPECMODE_3RDPERSON 5
#define SPECMODE_FREELOOK 6
Handle g_SpecList = INVALID_HANDLE;
bool g_SpecListShow[MAXPLAYERS + 1] = { true, ... };
public Plugin myinfo =
{
name = "Spec Upgrade",
author = PLUGIN_AUTHOR,
description = "Upgrades the spectators experience.",
version = PLUGIN_VERSION,
url = "http://finalrespawn.com/"
};
public void OnPluginStart()
{
g_SpecList = CreateTimer(3.0, Timer_SpecList, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
RegConsoleCmd("sm_speclist", Cmd_SpecList, "Toggle showing spec list.");
}
public void OnPluginEnd()
{
if (g_SpecList != INVALID_HANDLE)
{
KillTimer(g_SpecList);
g_SpecList = INVALID_HANDLE;
}
}
public void OnClientDisconnect(int client)
{
g_SpecListShow[client] = true;
}
public Action Timer_SpecList(Handle timer, any data)
{
for (int Client = 1; Client <= MaxClients; Client++)
{
if (!IsClientInGame(Client) || !g_SpecListShow[Client])
continue;
if (IsPlayerAlive(Client))
{
//Create our panel the players see.
Panel panel = new Panel(null);
int SpecCount;
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || !IsClientObserver(i))
continue;
int SpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
// The client isn't spectating any one person, so ignore them.
if (SpecMode != SPECMODE_FIRSTPERSON && SpecMode != SPECMODE_3RDPERSON)
continue;
//See who the client is spectating.
int Target = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
if (Target == Client)
{
char ClientName[32];
GetClientName(i, ClientName, 32);
panel.DrawText(ClientName);
SpecCount++;
}
}
char PanelTitle[16];
Format(PanelTitle, sizeof(PanelTitle), "Spec: %i", SpecCount);
if (SpecCount != 0)
{
panel.SetTitle(PanelTitle);
panel.Send (Client, Panel_Spec, 3);
}
}
}
return Plugin_Continue;
}
public int Panel_Spec(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Select)
{
return;
}
else if (action == MenuAction_End)
{
delete menu;
}
}
public Action Cmd_SpecList(int client, int args)
{
if (g_SpecListShow[client])
{
g_SpecListShow[client] = false;
PrintToChat(client, "[Final Respawn] Spec List has been disabled.");
return Plugin_Continue;
}
else
{
g_SpecListShow[client] = true;
PrintToChat(client, "[Final Respawn] Spec List has been enabled.");
return Plugin_Continue;
}
}