Leader2: add ping feature
This commit is contained in:
parent
76669c1cb1
commit
a750dccbc1
10
Leader2/content/materials/unloze/ping/ping.vmt
Normal file
10
Leader2/content/materials/unloze/ping/ping.vmt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"VertexLitGeneric"
|
||||||
|
{
|
||||||
|
"$basetexture" "unloze/ping/ping"
|
||||||
|
"$selfillum" "1"
|
||||||
|
"$selfillumtint" "[3 3 3]"
|
||||||
|
//"$selfillummaskscale" "10000"
|
||||||
|
"$additive" "1"
|
||||||
|
"$nocull" "1"
|
||||||
|
|
||||||
|
}
|
BIN
Leader2/content/materials/unloze/ping/ping.vtf
Normal file
BIN
Leader2/content/materials/unloze/ping/ping.vtf
Normal file
Binary file not shown.
10
Leader2/content/materials/unloze/ping/ping_cross.vmt
Normal file
10
Leader2/content/materials/unloze/ping/ping_cross.vmt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"VertexLitGeneric"
|
||||||
|
{
|
||||||
|
"$basetexture" "unloze/ping/ping_cross"
|
||||||
|
"$selfillum" "1"
|
||||||
|
"$selfillumtint" "[3 3 3]"
|
||||||
|
//"$selfillummaskscale" "10000"
|
||||||
|
"$additive" "1"
|
||||||
|
"$nocull" "1"
|
||||||
|
|
||||||
|
}
|
BIN
Leader2/content/materials/unloze/ping/ping_cross.vtf
Normal file
BIN
Leader2/content/materials/unloze/ping/ping_cross.vtf
Normal file
Binary file not shown.
10
Leader2/content/materials/unloze/ping/ping_moon.vmt
Normal file
10
Leader2/content/materials/unloze/ping/ping_moon.vmt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"VertexLitGeneric"
|
||||||
|
{
|
||||||
|
"$basetexture" "unloze/ping/ping_moon"
|
||||||
|
"$selfillum" "1"
|
||||||
|
"$selfillumtint" "[3 3 3]"
|
||||||
|
//"$selfillummaskscale" "10000"
|
||||||
|
"$additive" "1"
|
||||||
|
"$nocull" "1"
|
||||||
|
|
||||||
|
}
|
BIN
Leader2/content/materials/unloze/ping/ping_moon.vtf
Normal file
BIN
Leader2/content/materials/unloze/ping/ping_moon.vtf
Normal file
Binary file not shown.
10
Leader2/content/materials/unloze/ping/ping_skull.vmt
Normal file
10
Leader2/content/materials/unloze/ping/ping_skull.vmt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"VertexLitGeneric"
|
||||||
|
{
|
||||||
|
"$basetexture" "unloze/ping/ping_skull"
|
||||||
|
"$selfillum" "1"
|
||||||
|
"$selfillumtint" "[3 3 3]"
|
||||||
|
//"$selfillummaskscale" "10000"
|
||||||
|
"$additive" "1"
|
||||||
|
"$nocull" "1"
|
||||||
|
|
||||||
|
}
|
BIN
Leader2/content/materials/unloze/ping/ping_skull.vtf
Normal file
BIN
Leader2/content/materials/unloze/ping/ping_skull.vtf
Normal file
Binary file not shown.
BIN
Leader2/content/models/unloze/unloze_ping.dx80.vtx
Normal file
BIN
Leader2/content/models/unloze/unloze_ping.dx80.vtx
Normal file
Binary file not shown.
BIN
Leader2/content/models/unloze/unloze_ping.dx90.vtx
Normal file
BIN
Leader2/content/models/unloze/unloze_ping.dx90.vtx
Normal file
Binary file not shown.
BIN
Leader2/content/models/unloze/unloze_ping.mdl
Normal file
BIN
Leader2/content/models/unloze/unloze_ping.mdl
Normal file
Binary file not shown.
BIN
Leader2/content/models/unloze/unloze_ping.sw.vtx
Normal file
BIN
Leader2/content/models/unloze/unloze_ping.sw.vtx
Normal file
Binary file not shown.
BIN
Leader2/content/models/unloze/unloze_ping.vvd
Normal file
BIN
Leader2/content/models/unloze/unloze_ping.vvd
Normal file
Binary file not shown.
@ -8,14 +8,14 @@
|
|||||||
#include <voice>
|
#include <voice>
|
||||||
#include <basecomm>
|
#include <basecomm>
|
||||||
|
|
||||||
#define PLUGIN_VERSION "3.0"
|
#define PLUGIN_VERSION "4.0"
|
||||||
#define MAXLEADERS 64
|
#define MAXLEADERS 64
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
int currentSprite = -1, spriteEntities[MAXPLAYERS+1], markerEntities[MAXPLAYERS+1], leaderClient = -1;
|
int currentSprite = -1, spriteEntities[MAXPLAYERS+1], pingEntity0, pingEntity1, pingEntity2, pingEntity3, leaderClient = -1;
|
||||||
int voteCount[MAXPLAYERS+1], votedFor[MAXPLAYERS+1];
|
int voteCount[MAXPLAYERS+1], votedFor[MAXPLAYERS+1];
|
||||||
|
|
||||||
bool markerActive = false, beaconActive = false, allowVoting = false;
|
bool pingActive[4] = {false, ...}, beaconActive = false, allowVoting = false;
|
||||||
|
|
||||||
ConVar g_cVDefendVTF = null;
|
ConVar g_cVDefendVTF = null;
|
||||||
ConVar g_cVDefendVMT = null;
|
ConVar g_cVDefendVMT = null;
|
||||||
@ -45,8 +45,8 @@ bool g_bForceMute[MAXPLAYERS + 1] = { false, ...};
|
|||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Plugin myinfo = {
|
public Plugin myinfo = {
|
||||||
name = "Leader",
|
name = "Leader2",
|
||||||
author = "AntiTeal + Neon",
|
author = "AntiTeal + Neon + Dogan",
|
||||||
description = "Allows for a human to be a leader, and give them special functions with it.",
|
description = "Allows for a human to be a leader, and give them special functions with it.",
|
||||||
version = PLUGIN_VERSION,
|
version = PLUGIN_VERSION,
|
||||||
url = "https://antiteal.com"
|
url = "https://antiteal.com"
|
||||||
@ -63,6 +63,8 @@ public void OnPluginStart()
|
|||||||
LoadTranslations("common.phrases");
|
LoadTranslations("common.phrases");
|
||||||
LoadTranslations("core.phrases");
|
LoadTranslations("core.phrases");
|
||||||
|
|
||||||
|
AddTempEntHook("Player Decal", HookDecal);
|
||||||
|
|
||||||
HookEvent("round_end", Event_RoundEnd);
|
HookEvent("round_end", Event_RoundEnd);
|
||||||
HookEvent("player_death", Event_PlayerDeath);
|
HookEvent("player_death", Event_PlayerDeath);
|
||||||
//AddCommandListener(HookPlayerChat, "say");
|
//AddCommandListener(HookPlayerChat, "say");
|
||||||
@ -71,6 +73,7 @@ public void OnPluginStart()
|
|||||||
RegConsoleCmd("sm_currentleader", CurrentLeader);
|
RegConsoleCmd("sm_currentleader", CurrentLeader);
|
||||||
RegConsoleCmd("sm_leaders", Leaders);
|
RegConsoleCmd("sm_leaders", Leaders);
|
||||||
RegConsoleCmd("sm_voteleader", VoteLeader);
|
RegConsoleCmd("sm_voteleader", VoteLeader);
|
||||||
|
RegConsoleCmd("sm_pingmenu", ManualPingMenu);
|
||||||
RegAdminCmd("sm_removeleader", RemoveTheLeader, ADMFLAG_GENERIC);
|
RegAdminCmd("sm_removeleader", RemoveTheLeader, ADMFLAG_GENERIC);
|
||||||
RegAdminCmd("sm_reloadleaders", ReloadLeaders, ADMFLAG_GENERIC);
|
RegAdminCmd("sm_reloadleaders", ReloadLeaders, ADMFLAG_GENERIC);
|
||||||
RegAdminCmd("sm_forceleader", OnToggleForceLeader, ADMFLAG_GENERIC);
|
RegAdminCmd("sm_forceleader", OnToggleForceLeader, ADMFLAG_GENERIC);
|
||||||
@ -200,6 +203,22 @@ public void OnConfigsExecuted()
|
|||||||
AddFileToDownloadsTable(FollowVTF);
|
AddFileToDownloadsTable(FollowVTF);
|
||||||
AddFileToDownloadsTable(FollowVMT);
|
AddFileToDownloadsTable(FollowVMT);
|
||||||
|
|
||||||
|
PrecacheModel("models/unloze/unloze_ping.mdl");
|
||||||
|
AddFileToDownloadsTable("models/unloze/unloze_ping.dx80.vtx");
|
||||||
|
AddFileToDownloadsTable("models/unloze/unloze_ping.dx90.vtx");
|
||||||
|
AddFileToDownloadsTable("models/unloze/unloze_ping.mdl");
|
||||||
|
AddFileToDownloadsTable("models/unloze/unloze_ping.sw.vtx");
|
||||||
|
AddFileToDownloadsTable("models/unloze/unloze_ping.vvd");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping.vmt");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping.vtf");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping_cross.vmt");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping_cross.vtf");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping_moon.vmt");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping_moon.vtf");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping_skull.vmt");
|
||||||
|
AddFileToDownloadsTable("materials/unloze/ping/ping_skull.vtf");
|
||||||
|
|
||||||
|
|
||||||
PrecacheGeneric(DefendVTF, true);
|
PrecacheGeneric(DefendVTF, true);
|
||||||
PrecacheGeneric(DefendVMT, true);
|
PrecacheGeneric(DefendVMT, true);
|
||||||
PrecacheGeneric(FollowVTF, true);
|
PrecacheGeneric(FollowVTF, true);
|
||||||
@ -239,6 +258,22 @@ public void KillAllBeacons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void KillAllPings()
|
||||||
|
{
|
||||||
|
pingActive[0] = false;
|
||||||
|
pingActive[1] = false;
|
||||||
|
pingActive[2] = false;
|
||||||
|
pingActive[3] = false;
|
||||||
|
|
||||||
|
RemovePing0();
|
||||||
|
RemovePing1();
|
||||||
|
RemovePing2();
|
||||||
|
RemovePing3();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -351,16 +386,61 @@ public void RemoveSprite(int client)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void RemoveMarker(int client)
|
public void RemovePing0()
|
||||||
{
|
{
|
||||||
if (markerEntities[client] != -1 && IsValidEdict(markerEntities[client]))
|
if (pingEntity0 != -1 && IsValidEdict(pingEntity0))
|
||||||
{
|
{
|
||||||
char m_szClassname[64];
|
char m_szClassname[64];
|
||||||
GetEdictClassname(markerEntities[client], m_szClassname, sizeof(m_szClassname));
|
GetEdictClassname(pingEntity0, m_szClassname, sizeof(m_szClassname));
|
||||||
if(strcmp("env_sprite", m_szClassname)==0)
|
if(strcmp("prop_dynamic", m_szClassname)==0)
|
||||||
AcceptEntityInput(markerEntities[client], "Kill");
|
AcceptEntityInput(pingEntity0, "Kill");
|
||||||
}
|
}
|
||||||
markerEntities[client] = -1;
|
pingEntity0 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void RemovePing1()
|
||||||
|
{
|
||||||
|
if (pingEntity1 != -1 && IsValidEdict(pingEntity1))
|
||||||
|
{
|
||||||
|
char m_szClassname[64];
|
||||||
|
GetEdictClassname(pingEntity1, m_szClassname, sizeof(m_szClassname));
|
||||||
|
if(strcmp("prop_dynamic", m_szClassname)==0)
|
||||||
|
AcceptEntityInput(pingEntity1, "Kill");
|
||||||
|
}
|
||||||
|
pingEntity1 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void RemovePing2()
|
||||||
|
{
|
||||||
|
if (pingEntity2 != -1 && IsValidEdict(pingEntity2))
|
||||||
|
{
|
||||||
|
char m_szClassname[64];
|
||||||
|
GetEdictClassname(pingEntity2, m_szClassname, sizeof(m_szClassname));
|
||||||
|
if(strcmp("prop_dynamic", m_szClassname)==0)
|
||||||
|
AcceptEntityInput(pingEntity2, "Kill");
|
||||||
|
}
|
||||||
|
pingEntity2 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public void RemovePing3()
|
||||||
|
{
|
||||||
|
if (pingEntity3 != -1 && IsValidEdict(pingEntity3))
|
||||||
|
{
|
||||||
|
char m_szClassname[64];
|
||||||
|
GetEdictClassname(pingEntity3, m_szClassname, sizeof(m_szClassname));
|
||||||
|
if(strcmp("prop_dynamic", m_szClassname)==0)
|
||||||
|
AcceptEntityInput(pingEntity3, "Kill");
|
||||||
|
}
|
||||||
|
pingEntity3 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -400,7 +480,6 @@ public void ToggleForceLeader(int client)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public Action CheckLeaderVoice(Handle timer)
|
public Action CheckLeaderVoice(Handle timer)
|
||||||
{
|
{
|
||||||
if(!g_bForceLeader || leaderClient == -1)
|
if(!g_bForceLeader || leaderClient == -1)
|
||||||
@ -437,6 +516,7 @@ public Action CheckLeaderVoice(Handle timer)
|
|||||||
|
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -475,7 +555,6 @@ public void RemoveLeader(int client)
|
|||||||
//CS_SetClientContributionScore(client, leaderScore);
|
//CS_SetClientContributionScore(client, leaderScore);
|
||||||
|
|
||||||
RemoveSprite(client);
|
RemoveSprite(client);
|
||||||
RemoveMarker(client);
|
|
||||||
|
|
||||||
if(beaconActive)
|
if(beaconActive)
|
||||||
{
|
{
|
||||||
@ -484,7 +563,6 @@ public void RemoveLeader(int client)
|
|||||||
|
|
||||||
currentSprite = -1;
|
currentSprite = -1;
|
||||||
leaderClient = -1;
|
leaderClient = -1;
|
||||||
markerActive = false;
|
|
||||||
beaconActive = false;
|
beaconActive = false;
|
||||||
|
|
||||||
for(int i = 1; i < MaxClients; i++)
|
for(int i = 1; i < MaxClients; i++)
|
||||||
@ -500,28 +578,27 @@ public void RemoveLeader(int client)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public int SpawnMarker(int client, char[] sprite)
|
public int SpawnPing(int client, int skin)
|
||||||
{
|
{
|
||||||
if(!IsPlayerAlive(client))
|
float vecAimPoint[3];
|
||||||
{
|
TracePlayerAngles(client, vecAimPoint);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
float Origin[3];
|
int Ent = CreateEntityByName("prop_dynamic");
|
||||||
GetClientEyePosition(client, Origin);
|
SetEntityModel(Ent, "models/unloze/unloze_ping.mdl");
|
||||||
Origin[2] += 25.0;
|
DispatchKeyValue(Ent, "modelscale", "1.5");
|
||||||
|
|
||||||
int Ent = CreateEntityByName("env_sprite");
|
if (skin == 0)
|
||||||
if(!Ent) return -1;
|
SetVariantString("0");
|
||||||
|
else if (skin == 1)
|
||||||
|
SetVariantString("1");
|
||||||
|
else if (skin == 2)
|
||||||
|
SetVariantString("2");
|
||||||
|
else if (skin == 3)
|
||||||
|
SetVariantString("3");
|
||||||
|
|
||||||
DispatchKeyValue(Ent, "model", sprite);
|
AcceptEntityInput(Ent, "Skin");
|
||||||
DispatchKeyValue(Ent, "classname", "env_sprite");
|
|
||||||
DispatchKeyValue(Ent, "spawnflags", "1");
|
|
||||||
DispatchKeyValue(Ent, "scale", "0.1");
|
|
||||||
DispatchKeyValue(Ent, "rendermode", "1");
|
|
||||||
DispatchKeyValue(Ent, "rendercolor", "255 255 255");
|
|
||||||
DispatchSpawn(Ent);
|
DispatchSpawn(Ent);
|
||||||
TeleportEntity(Ent, Origin, NULL_VECTOR, NULL_VECTOR);
|
TeleportEntity(Ent, vecAimPoint, NULL_VECTOR, NULL_VECTOR);
|
||||||
|
|
||||||
return Ent;
|
return Ent;
|
||||||
}
|
}
|
||||||
@ -543,6 +620,54 @@ public Action CurrentLeader(int client, int args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public Action ManualPingMenu(int client, int args)
|
||||||
|
{
|
||||||
|
if(client == 0)
|
||||||
|
{
|
||||||
|
ReplyToCommand(client, "[SM] Cannot use this from console.");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CheckCommandAccess(client, "", ADMFLAG_GENERIC) || client == leaderClient)
|
||||||
|
{
|
||||||
|
if(GetClientTeam(client) == CS_TEAM_T)
|
||||||
|
{
|
||||||
|
ReplyToCommand(client, "[SM] Cannot use this while being in the Zombie Team.");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PingMenu(client);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ReplyToCommand(client, "[SM] You do not have access to this command.");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public Action HookDecal(const char[] sTEName, const int[] iClients, int iNumClients, float fSendDelay)
|
||||||
|
{
|
||||||
|
int client = TE_ReadNum("m_nPlayer");
|
||||||
|
|
||||||
|
if(client == leaderClient)
|
||||||
|
{
|
||||||
|
RemovePing0();
|
||||||
|
pingEntity0 = SpawnPing(client, 1);
|
||||||
|
pingActive[0] = true;
|
||||||
|
PrintToChat(client, "[SM] 'Skull' Ping (re)placed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -851,7 +976,7 @@ public void LeaderMenu(int client)
|
|||||||
{
|
{
|
||||||
Handle menu = CreateMenu(LeaderMenu_Handler);
|
Handle menu = CreateMenu(LeaderMenu_Handler);
|
||||||
|
|
||||||
char sprite[64], marker[64], beacon[64];
|
char sprite[64], ping[4][64], beacon[64];
|
||||||
|
|
||||||
switch (currentSprite)
|
switch (currentSprite)
|
||||||
{
|
{
|
||||||
@ -863,20 +988,39 @@ public void LeaderMenu(int client)
|
|||||||
sprite = "None";
|
sprite = "None";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(markerActive)
|
|
||||||
marker = "Yes";
|
|
||||||
else
|
|
||||||
marker = "No";
|
|
||||||
|
|
||||||
if(beaconActive)
|
if(beaconActive)
|
||||||
beacon = "Yes";
|
beacon = "Yes";
|
||||||
else
|
else
|
||||||
beacon = "No";
|
beacon = "No";
|
||||||
|
|
||||||
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nMarker: %s\nBeacon: %s", sprite, marker, beacon);
|
if(pingActive[0])
|
||||||
|
ping[0] = "Skull";
|
||||||
|
|
||||||
|
if(pingActive[1])
|
||||||
|
ping[1] = "Cross";
|
||||||
|
|
||||||
|
if(pingActive[2])
|
||||||
|
ping[2] = "Moon";
|
||||||
|
|
||||||
|
if(pingActive[3])
|
||||||
|
ping[3] = "Star";
|
||||||
|
|
||||||
|
char pings[256];
|
||||||
|
for(int i = 0; i <= 3; i++)
|
||||||
|
{
|
||||||
|
if(!StrEqual(ping[i], ""))
|
||||||
|
StrCat(pings, sizeof(pings), ping[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strlen(pings))
|
||||||
|
pings[strlen(pings) - 2] = 0;
|
||||||
|
else
|
||||||
|
pings = "none";
|
||||||
|
|
||||||
|
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nPings: %s\nBeacon: %s", sprite, pings, beacon);
|
||||||
AddMenuItem(menu, "resign", "Resign from Leader");
|
AddMenuItem(menu, "resign", "Resign from Leader");
|
||||||
AddMenuItem(menu, "sprite", "Sprite Menu");
|
AddMenuItem(menu, "sprite", "Sprite Menu");
|
||||||
AddMenuItem(menu, "marker", "Marker Menu");
|
AddMenuItem(menu, "ping", "Ping Menu");
|
||||||
AddMenuItem(menu, "beacon", "Toggle Beacon");
|
AddMenuItem(menu, "beacon", "Toggle Beacon");
|
||||||
|
|
||||||
SetMenuExitButton(menu, true);
|
SetMenuExitButton(menu, true);
|
||||||
@ -904,9 +1048,9 @@ public int LeaderMenu_Handler(Handle menu, MenuAction action, int client, int po
|
|||||||
{
|
{
|
||||||
SpriteMenu(client);
|
SpriteMenu(client);
|
||||||
}
|
}
|
||||||
if(StrEqual(info, "marker"))
|
if(StrEqual(info, "ping"))
|
||||||
{
|
{
|
||||||
MarkerMenu(client);
|
PingMenu(client);
|
||||||
}
|
}
|
||||||
if(StrEqual(info, "beacon"))
|
if(StrEqual(info, "beacon"))
|
||||||
{
|
{
|
||||||
@ -942,7 +1086,7 @@ public void SpriteMenu(int client)
|
|||||||
{
|
{
|
||||||
Handle menu = CreateMenu(SpriteMenu_Handler);
|
Handle menu = CreateMenu(SpriteMenu_Handler);
|
||||||
|
|
||||||
char sprite[64], marker[64], beacon[64];
|
char sprite[64], ping[4][64], beacon[64];
|
||||||
|
|
||||||
switch (currentSprite)
|
switch (currentSprite)
|
||||||
{
|
{
|
||||||
@ -954,17 +1098,36 @@ public void SpriteMenu(int client)
|
|||||||
sprite = "None";
|
sprite = "None";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(markerActive)
|
|
||||||
marker = "Yes";
|
|
||||||
else
|
|
||||||
marker = "No";
|
|
||||||
|
|
||||||
if(beaconActive)
|
if(beaconActive)
|
||||||
beacon = "Yes";
|
beacon = "Yes";
|
||||||
else
|
else
|
||||||
beacon = "No";
|
beacon = "No";
|
||||||
|
|
||||||
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nMarker: %s\nBeacon: %s", sprite, marker, beacon);
|
if(pingActive[0])
|
||||||
|
ping[0] = "Skull";
|
||||||
|
|
||||||
|
if(pingActive[1])
|
||||||
|
ping[1] = "Cross";
|
||||||
|
|
||||||
|
if(pingActive[2])
|
||||||
|
ping[2] = "Moon";
|
||||||
|
|
||||||
|
if(pingActive[3])
|
||||||
|
ping[3] = "Star";
|
||||||
|
|
||||||
|
char pings[256];
|
||||||
|
for(int i = 0; i <= 3; i++)
|
||||||
|
{
|
||||||
|
if(!StrEqual(ping[i], ""))
|
||||||
|
StrCat(pings, sizeof(pings), ping[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strlen(pings))
|
||||||
|
pings[strlen(pings) - 2] = 0;
|
||||||
|
else
|
||||||
|
pings = "none";
|
||||||
|
|
||||||
|
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nPings: %s\nBeacon: %s", sprite, pings, beacon);
|
||||||
AddMenuItem(menu, "none", "No Sprite");
|
AddMenuItem(menu, "none", "No Sprite");
|
||||||
AddMenuItem(menu, "defend", "Defend Here");
|
AddMenuItem(menu, "defend", "Defend Here");
|
||||||
AddMenuItem(menu, "follow", "Follow Me");
|
AddMenuItem(menu, "follow", "Follow Me");
|
||||||
@ -1024,11 +1187,11 @@ public int SpriteMenu_Handler(Handle menu, MenuAction action, int client, int po
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void MarkerMenu(int client)
|
public void PingMenu(int client)
|
||||||
{
|
{
|
||||||
Handle menu = CreateMenu(MarkerMenu_Handler);
|
Handle menu = CreateMenu(PingMenu_Handler);
|
||||||
|
|
||||||
char sprite[64], marker[64], beacon[64];
|
char sprite[64], ping[4][64], beacon[64];
|
||||||
|
|
||||||
switch (currentSprite)
|
switch (currentSprite)
|
||||||
{
|
{
|
||||||
@ -1040,19 +1203,41 @@ public void MarkerMenu(int client)
|
|||||||
sprite = "None";
|
sprite = "None";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(markerActive)
|
|
||||||
marker = "Yes";
|
|
||||||
else
|
|
||||||
marker = "No";
|
|
||||||
|
|
||||||
if(beaconActive)
|
if(beaconActive)
|
||||||
beacon = "Yes";
|
beacon = "Yes";
|
||||||
else
|
else
|
||||||
beacon = "No";
|
beacon = "No";
|
||||||
|
|
||||||
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nMarker: %s\nBeacon: %s", sprite, marker, beacon);
|
if(pingActive[0])
|
||||||
AddMenuItem(menu, "removemarker", "Remove Marker");
|
ping[0] = "Skull";
|
||||||
AddMenuItem(menu, "defendmarker", "Defend Marker");
|
|
||||||
|
if(pingActive[1])
|
||||||
|
ping[1] = "Cross";
|
||||||
|
|
||||||
|
if(pingActive[2])
|
||||||
|
ping[2] = "Moon";
|
||||||
|
|
||||||
|
if(pingActive[3])
|
||||||
|
ping[3] = "Star";
|
||||||
|
|
||||||
|
char pings[256];
|
||||||
|
for(int i = 0; i <= 3; i++)
|
||||||
|
{
|
||||||
|
if(!StrEqual(ping[i], ""))
|
||||||
|
StrCat(pings, sizeof(pings), ping[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strlen(pings))
|
||||||
|
pings[strlen(pings) - 2] = 0;
|
||||||
|
else
|
||||||
|
pings = "none";
|
||||||
|
|
||||||
|
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nPings: %s\nBeacon: %s", sprite, pings, beacon);
|
||||||
|
AddMenuItem(menu, "ping0", "Skull");
|
||||||
|
AddMenuItem(menu, "ping1", "Cross");
|
||||||
|
AddMenuItem(menu, "ping2", "Moon");
|
||||||
|
AddMenuItem(menu, "ping3", "Star");
|
||||||
|
AddMenuItem(menu, "remove", "Remove All");
|
||||||
|
|
||||||
SetMenuExitBackButton(menu, true);
|
SetMenuExitBackButton(menu, true);
|
||||||
SetMenuExitButton(menu, true);
|
SetMenuExitButton(menu, true);
|
||||||
@ -1062,36 +1247,62 @@ public void MarkerMenu(int client)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public int MarkerMenu_Handler(Handle menu, MenuAction action, int client, int position)
|
public int PingMenu_Handler(Handle menu, MenuAction action, int client, int position)
|
||||||
{
|
{
|
||||||
if(leaderClient == client && IsValidClient(client))
|
if(IsValidClient(client))
|
||||||
{
|
{
|
||||||
if(action == MenuAction_Select)
|
if(action == MenuAction_Select)
|
||||||
{
|
{
|
||||||
char info[32];
|
char info[32];
|
||||||
GetMenuItem(menu, position, info, sizeof(info));
|
GetMenuItem(menu, position, info, sizeof(info));
|
||||||
|
|
||||||
if(StrEqual(info, "removemarker"))
|
if(StrEqual(info, "ping0"))
|
||||||
{
|
{
|
||||||
RemoveMarker(client);
|
RemovePing0();
|
||||||
PrintToChat(client, "[SM] Marker removed.");
|
pingEntity0 = SpawnPing(client, 1);
|
||||||
markerActive = false;
|
PrintToChat(client, "[SM] 'Skull' Ping (re)placed.");
|
||||||
LeaderMenu(client);
|
pingActive[0] = true;
|
||||||
|
PingMenu(client);
|
||||||
}
|
}
|
||||||
if(StrEqual(info, "defendmarker"))
|
|
||||||
|
if(StrEqual(info, "ping1"))
|
||||||
{
|
{
|
||||||
RemoveMarker(client);
|
RemovePing1();
|
||||||
markerEntities[client] = SpawnMarker(client, DefendVMT);
|
pingEntity1 = SpawnPing(client, 3);
|
||||||
PrintToChat(client, "[SM] 'Defend Here' marker placed.");
|
PrintToChat(client, "[SM] 'Cross' Ping (re)placed.");
|
||||||
markerActive = true;
|
pingActive[1] = true;
|
||||||
LeaderMenu(client);
|
PingMenu(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrEqual(info, "ping2"))
|
||||||
|
{
|
||||||
|
RemovePing2();
|
||||||
|
pingEntity2 = SpawnPing(client, 2);
|
||||||
|
PrintToChat(client, "[SM] 'Moon' Ping (re)placed.");
|
||||||
|
pingActive[2] = true;
|
||||||
|
PingMenu(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrEqual(info, "ping3"))
|
||||||
|
{
|
||||||
|
RemovePing3();
|
||||||
|
pingEntity3 = SpawnPing(client, 0);
|
||||||
|
PrintToChat(client, "[SM] 'Star' Ping (re)placed.");
|
||||||
|
pingActive[3] = true;
|
||||||
|
PingMenu(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrEqual(info, "remove"))
|
||||||
|
{
|
||||||
|
KillAllPings();
|
||||||
|
PrintToChat(client, "[SM] All Pings removed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(action == MenuAction_End)
|
else if(action == MenuAction_End)
|
||||||
{
|
{
|
||||||
delete menu;
|
delete menu;
|
||||||
}
|
}
|
||||||
else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
|
else if (leaderClient == client && action == MenuAction_Cancel && position == MenuCancel_ExitBack)
|
||||||
{
|
{
|
||||||
LeaderMenu(client);
|
LeaderMenu(client);
|
||||||
}
|
}
|
||||||
@ -1182,6 +1393,7 @@ public Action Event_RoundEnd(Handle event, char[] name, bool dontBroadcast)
|
|||||||
g_bForceLeader = false;
|
g_bForceLeader = false;
|
||||||
|
|
||||||
KillAllBeacons();
|
KillAllBeacons();
|
||||||
|
//KillAllPings();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -1339,3 +1551,35 @@ public Action VoteLeader(int client, int argc)
|
|||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TracePlayerAngles(int client, float vecResult[3])
|
||||||
|
{
|
||||||
|
if (!IsClientInGame(client))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
float vecEyeAngles[3];
|
||||||
|
float vecEyeOrigin[3];
|
||||||
|
|
||||||
|
GetClientEyeAngles(client, vecEyeAngles);
|
||||||
|
GetClientEyePosition(client, vecEyeOrigin);
|
||||||
|
|
||||||
|
Handle hTraceRay = TR_TraceRayFilterEx(vecEyeOrigin, vecEyeAngles, MASK_SHOT_HULL, RayType_Infinite, TraceEntityFilter_FilterPlayers);
|
||||||
|
|
||||||
|
if (TR_DidHit(hTraceRay))
|
||||||
|
{
|
||||||
|
TR_GetEndPosition(vecResult, hTraceRay);
|
||||||
|
|
||||||
|
delete hTraceRay;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete hTraceRay;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
stock bool TraceEntityFilter_FilterPlayers(int entity, int contentsMask)
|
||||||
|
{
|
||||||
|
return entity > MaxClients;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user