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 <basecomm>
|
||||
|
||||
#define PLUGIN_VERSION "3.0"
|
||||
#define PLUGIN_VERSION "4.0"
|
||||
#define MAXLEADERS 64
|
||||
#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];
|
||||
|
||||
bool markerActive = false, beaconActive = false, allowVoting = false;
|
||||
bool pingActive[4] = {false, ...}, beaconActive = false, allowVoting = false;
|
||||
|
||||
ConVar g_cVDefendVTF = null;
|
||||
ConVar g_cVDefendVMT = null;
|
||||
@ -45,8 +45,8 @@ bool g_bForceMute[MAXPLAYERS + 1] = { false, ...};
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin myinfo = {
|
||||
name = "Leader",
|
||||
author = "AntiTeal + Neon",
|
||||
name = "Leader2",
|
||||
author = "AntiTeal + Neon + Dogan",
|
||||
description = "Allows for a human to be a leader, and give them special functions with it.",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "https://antiteal.com"
|
||||
@ -63,6 +63,8 @@ public void OnPluginStart()
|
||||
LoadTranslations("common.phrases");
|
||||
LoadTranslations("core.phrases");
|
||||
|
||||
AddTempEntHook("Player Decal", HookDecal);
|
||||
|
||||
HookEvent("round_end", Event_RoundEnd);
|
||||
HookEvent("player_death", Event_PlayerDeath);
|
||||
//AddCommandListener(HookPlayerChat, "say");
|
||||
@ -71,6 +73,7 @@ public void OnPluginStart()
|
||||
RegConsoleCmd("sm_currentleader", CurrentLeader);
|
||||
RegConsoleCmd("sm_leaders", Leaders);
|
||||
RegConsoleCmd("sm_voteleader", VoteLeader);
|
||||
RegConsoleCmd("sm_pingmenu", ManualPingMenu);
|
||||
RegAdminCmd("sm_removeleader", RemoveTheLeader, ADMFLAG_GENERIC);
|
||||
RegAdminCmd("sm_reloadleaders", ReloadLeaders, ADMFLAG_GENERIC);
|
||||
RegAdminCmd("sm_forceleader", OnToggleForceLeader, ADMFLAG_GENERIC);
|
||||
@ -200,6 +203,22 @@ public void OnConfigsExecuted()
|
||||
AddFileToDownloadsTable(FollowVTF);
|
||||
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(DefendVMT, 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:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -351,16 +386,61 @@ public void RemoveSprite(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 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];
|
||||
GetEdictClassname(markerEntities[client], m_szClassname, sizeof(m_szClassname));
|
||||
if(strcmp("env_sprite", m_szClassname)==0)
|
||||
AcceptEntityInput(markerEntities[client], "Kill");
|
||||
GetEdictClassname(pingEntity0, m_szClassname, sizeof(m_szClassname));
|
||||
if(strcmp("prop_dynamic", m_szClassname)==0)
|
||||
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:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
public Action CheckLeaderVoice(Handle timer)
|
||||
{
|
||||
if(!g_bForceLeader || leaderClient == -1)
|
||||
@ -437,6 +516,7 @@ public Action CheckLeaderVoice(Handle timer)
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -475,7 +555,6 @@ public void RemoveLeader(int client)
|
||||
//CS_SetClientContributionScore(client, leaderScore);
|
||||
|
||||
RemoveSprite(client);
|
||||
RemoveMarker(client);
|
||||
|
||||
if(beaconActive)
|
||||
{
|
||||
@ -484,7 +563,6 @@ public void RemoveLeader(int client)
|
||||
|
||||
currentSprite = -1;
|
||||
leaderClient = -1;
|
||||
markerActive = false;
|
||||
beaconActive = false;
|
||||
|
||||
for(int i = 1; i < MaxClients; i++)
|
||||
@ -500,28 +578,27 @@ public void RemoveLeader(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public int SpawnMarker(int client, char[] sprite)
|
||||
public int SpawnPing(int client, int skin)
|
||||
{
|
||||
if(!IsPlayerAlive(client))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
float vecAimPoint[3];
|
||||
TracePlayerAngles(client, vecAimPoint);
|
||||
|
||||
float Origin[3];
|
||||
GetClientEyePosition(client, Origin);
|
||||
Origin[2] += 25.0;
|
||||
int Ent = CreateEntityByName("prop_dynamic");
|
||||
SetEntityModel(Ent, "models/unloze/unloze_ping.mdl");
|
||||
DispatchKeyValue(Ent, "modelscale", "1.5");
|
||||
|
||||
int Ent = CreateEntityByName("env_sprite");
|
||||
if(!Ent) return -1;
|
||||
if (skin == 0)
|
||||
SetVariantString("0");
|
||||
else if (skin == 1)
|
||||
SetVariantString("1");
|
||||
else if (skin == 2)
|
||||
SetVariantString("2");
|
||||
else if (skin == 3)
|
||||
SetVariantString("3");
|
||||
|
||||
DispatchKeyValue(Ent, "model", sprite);
|
||||
DispatchKeyValue(Ent, "classname", "env_sprite");
|
||||
DispatchKeyValue(Ent, "spawnflags", "1");
|
||||
DispatchKeyValue(Ent, "scale", "0.1");
|
||||
DispatchKeyValue(Ent, "rendermode", "1");
|
||||
DispatchKeyValue(Ent, "rendercolor", "255 255 255");
|
||||
AcceptEntityInput(Ent, "Skin");
|
||||
DispatchSpawn(Ent);
|
||||
TeleportEntity(Ent, Origin, NULL_VECTOR, NULL_VECTOR);
|
||||
TeleportEntity(Ent, vecAimPoint, NULL_VECTOR, NULL_VECTOR);
|
||||
|
||||
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:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -851,7 +976,7 @@ public void LeaderMenu(int client)
|
||||
{
|
||||
Handle menu = CreateMenu(LeaderMenu_Handler);
|
||||
|
||||
char sprite[64], marker[64], beacon[64];
|
||||
char sprite[64], ping[4][64], beacon[64];
|
||||
|
||||
switch (currentSprite)
|
||||
{
|
||||
@ -863,20 +988,39 @@ public void LeaderMenu(int client)
|
||||
sprite = "None";
|
||||
}
|
||||
|
||||
if(markerActive)
|
||||
marker = "Yes";
|
||||
else
|
||||
marker = "No";
|
||||
|
||||
if(beaconActive)
|
||||
beacon = "Yes";
|
||||
else
|
||||
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, "sprite", "Sprite Menu");
|
||||
AddMenuItem(menu, "marker", "Marker Menu");
|
||||
AddMenuItem(menu, "ping", "Ping Menu");
|
||||
AddMenuItem(menu, "beacon", "Toggle Beacon");
|
||||
|
||||
SetMenuExitButton(menu, true);
|
||||
@ -904,9 +1048,9 @@ public int LeaderMenu_Handler(Handle menu, MenuAction action, int client, int po
|
||||
{
|
||||
SpriteMenu(client);
|
||||
}
|
||||
if(StrEqual(info, "marker"))
|
||||
if(StrEqual(info, "ping"))
|
||||
{
|
||||
MarkerMenu(client);
|
||||
PingMenu(client);
|
||||
}
|
||||
if(StrEqual(info, "beacon"))
|
||||
{
|
||||
@ -942,7 +1086,7 @@ public void SpriteMenu(int client)
|
||||
{
|
||||
Handle menu = CreateMenu(SpriteMenu_Handler);
|
||||
|
||||
char sprite[64], marker[64], beacon[64];
|
||||
char sprite[64], ping[4][64], beacon[64];
|
||||
|
||||
switch (currentSprite)
|
||||
{
|
||||
@ -954,17 +1098,36 @@ public void SpriteMenu(int client)
|
||||
sprite = "None";
|
||||
}
|
||||
|
||||
if(markerActive)
|
||||
marker = "Yes";
|
||||
else
|
||||
marker = "No";
|
||||
|
||||
if(beaconActive)
|
||||
beacon = "Yes";
|
||||
else
|
||||
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, "defend", "Defend Here");
|
||||
AddMenuItem(menu, "follow", "Follow Me");
|
||||
@ -1024,11 +1187,11 @@ public int SpriteMenu_Handler(Handle menu, MenuAction action, int client, int po
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 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)
|
||||
{
|
||||
@ -1040,19 +1203,41 @@ public void MarkerMenu(int client)
|
||||
sprite = "None";
|
||||
}
|
||||
|
||||
if(markerActive)
|
||||
marker = "Yes";
|
||||
else
|
||||
marker = "No";
|
||||
|
||||
if(beaconActive)
|
||||
beacon = "Yes";
|
||||
else
|
||||
beacon = "No";
|
||||
|
||||
SetMenuTitle(menu, "Leader Menu\nSprite: %s\nMarker: %s\nBeacon: %s", sprite, marker, beacon);
|
||||
AddMenuItem(menu, "removemarker", "Remove Marker");
|
||||
AddMenuItem(menu, "defendmarker", "Defend Marker");
|
||||
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, "ping0", "Skull");
|
||||
AddMenuItem(menu, "ping1", "Cross");
|
||||
AddMenuItem(menu, "ping2", "Moon");
|
||||
AddMenuItem(menu, "ping3", "Star");
|
||||
AddMenuItem(menu, "remove", "Remove All");
|
||||
|
||||
SetMenuExitBackButton(menu, true);
|
||||
SetMenuExitButton(menu, true);
|
||||
@ -1062,36 +1247,62 @@ public void MarkerMenu(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 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)
|
||||
{
|
||||
char info[32];
|
||||
GetMenuItem(menu, position, info, sizeof(info));
|
||||
|
||||
if(StrEqual(info, "removemarker"))
|
||||
if(StrEqual(info, "ping0"))
|
||||
{
|
||||
RemoveMarker(client);
|
||||
PrintToChat(client, "[SM] Marker removed.");
|
||||
markerActive = false;
|
||||
LeaderMenu(client);
|
||||
RemovePing0();
|
||||
pingEntity0 = SpawnPing(client, 1);
|
||||
PrintToChat(client, "[SM] 'Skull' Ping (re)placed.");
|
||||
pingActive[0] = true;
|
||||
PingMenu(client);
|
||||
}
|
||||
if(StrEqual(info, "defendmarker"))
|
||||
|
||||
if(StrEqual(info, "ping1"))
|
||||
{
|
||||
RemoveMarker(client);
|
||||
markerEntities[client] = SpawnMarker(client, DefendVMT);
|
||||
PrintToChat(client, "[SM] 'Defend Here' marker placed.");
|
||||
markerActive = true;
|
||||
LeaderMenu(client);
|
||||
RemovePing1();
|
||||
pingEntity1 = SpawnPing(client, 3);
|
||||
PrintToChat(client, "[SM] 'Cross' Ping (re)placed.");
|
||||
pingActive[1] = true;
|
||||
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)
|
||||
{
|
||||
delete menu;
|
||||
}
|
||||
else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
|
||||
else if (leaderClient == client && action == MenuAction_Cancel && position == MenuCancel_ExitBack)
|
||||
{
|
||||
LeaderMenu(client);
|
||||
}
|
||||
@ -1182,6 +1393,7 @@ public Action Event_RoundEnd(Handle event, char[] name, bool dontBroadcast)
|
||||
g_bForceLeader = false;
|
||||
|
||||
KillAllBeacons();
|
||||
//KillAllPings();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -1338,4 +1550,36 @@ public Action VoteLeader(int client, int argc)
|
||||
}
|
||||
|
||||
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