Permalink
Browse files

Simplify body found

  • Loading branch information...
Bara committed Jan 19, 2019
1 parent 4d97bed commit 6402e5ad0beba265599016d94bf0502a20066881
Showing with 46 additions and 82 deletions.
  1. +44 −80 addons/sourcemod/scripting/ttt/ttt.sp
  2. +2 −2 addons/sourcemod/scripting/ttt/ttt_hurtshot.sp
@@ -3414,11 +3414,13 @@ public int TTT_OnButtonPress(int client, int button)
if (IsPlayerAlive(client) && !g_bIsChecking[client])
{
g_bIsChecking[client] = true;

Action res = Plugin_Continue;
Call_StartForward(g_hOnBodyCheck);
Call_PushCell(client);
Call_PushArrayEx(iRagdollC[0], sizeof(iRagdollC), SM_PARAM_COPYBACK);
Call_Finish(res);

if (res == Plugin_Stop || res == Plugin_Handled)
{
return;
@@ -3462,102 +3464,64 @@ public int TTT_OnButtonPress(int client, int button)

char sRole[ROLE_LENGTH];
TTT_GetRoleNameByID(g_iRole[client], sRole, sizeof(sRole));

char sVictimRole[ROLE_LENGTH];
TTT_GetRoleNameByID(iRagdollC[VictimTeam], sVictimRole, sizeof(sVictimRole));

bool bSetColor = false;

if (iRagdollC[VictimTeam] == TTT_TEAM_INNOCENT)
if (!g_cSilentIdEnabled.BoolValue || !(bInWalk && TTT_IsValidRole(client, g_cSilentIdRoles.IntValue)))
{
if (!g_cSilentIdEnabled.BoolValue || !(bInWalk && TTT_IsValidRole(client, g_cSilentIdRoles.IntValue)))
char sBuffer[32];
Format(sBuffer, sizeof(sBuffer), "Found %s", sVictimRole);

LoopValidClients(j)
{
LoopValidClients(j)
{
CPrintToChat(j, "%s %T", g_sTag, "Found Innocent", j, client, iRagdollC[VictimName]);
}

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (Innocent)", client, sRole, iRagdollC[VictimName]);

SetEntityRenderColor(iEntity, 0, 255, 0, 255);
}
else
{
CPrintToChat(client, "%s %T", g_sTag, "Found Innocent Silent", client, iRagdollC[VictimName]);

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (Innocent) - SILENT", client, sRole, iRagdollC[VictimName]);

if (g_cSilentIdColor.BoolValue)
{
SetEntityRenderColor(iEntity, 0, 255, 0, 255);
}

silentID = true;
}

if (g_cIdentifyLog.BoolValue)
{
addArrayTime(iItem);
CPrintToChat(j, "%s %T", g_sTag, sBuffer, j, client, iRagdollC[VictimName]);
}

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (%s)", client, sRole, iRagdollC[VictimName], sVictimRole);

bSetColor = true;
}
else if (iRagdollC[VictimTeam] == TTT_TEAM_DETECTIVE)
else
{
if (!g_cSilentIdEnabled.BoolValue || !(bInWalk && TTT_IsValidRole(client, g_cSilentIdRoles.IntValue)))
{
LoopValidClients(j)
{
CPrintToChat(j, "%s %T", g_sTag, "Found Detective", j, client, iRagdollC[VictimName]);
}

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (Detective)", client, sRole, iRagdollC[VictimName]);

SetEntityRenderColor(iEntity, 0, 0, 255, 255);
}
else
char sBuffer[32];
Format(sBuffer, sizeof(sBuffer), "Found %s Silent", sVictimRole);

CPrintToChat(client, "%s %T", g_sTag, sBuffer, client, iRagdollC[VictimName]);

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (%s) - SILENT", client, sRole, iRagdollC[VictimName], sVictimRole);

if (g_cSilentIdColor.BoolValue)
{
CPrintToChat(client, "%s %T", g_sTag, "Found Detective Silent", client, iRagdollC[VictimName]);

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (Detective) - SILENT", client, sRole, iRagdollC[VictimName]);

if (g_cSilentIdColor.BoolValue)
{
SetEntityRenderColor(iEntity, 0, 0, 255, 255);
}

silentID = true;
bSetColor = true;
}

if (g_cIdentifyLog.BoolValue)
{
addArrayTime(iItem);
}
silentID = true;
}
else if (iRagdollC[VictimTeam] == TTT_TEAM_TRAITOR)

if (bSetColor)
{
if (!g_cSilentIdEnabled.BoolValue || !(bInWalk && TTT_IsValidRole(client, g_cSilentIdRoles.IntValue)))
if (iRagdollC[VictimTeam] == TTT_TEAM_INNOCENT)
{
LoopValidClients(j)
{
CPrintToChat(j, "%s %T", g_sTag, "Found Traitor", j, client, iRagdollC[VictimName]);
}

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (Traitor)", client, sRole, iRagdollC[VictimName]);

SetEntityRenderColor(iEntity, 255, 0, 0, 255);
SetEntityRenderColor(iEntity, 0, 255, 0, 255);
}
else
else if (iRagdollC[VictimTeam] == TTT_TEAM_DETECTIVE)
{
CPrintToChat(client, "%s %T", g_sTag, "Found Traitor Silent", client, iRagdollC[VictimName]);

Format(iItem, sizeof(iItem), "-> %N (%s) identified body of %s (Traitor) - SILENT", client, sRole, iRagdollC[VictimName]);

if (g_cSilentIdColor.BoolValue)
{
SetEntityRenderColor(iEntity, 255, 0, 0, 255);
}

silentID = true;
SetEntityRenderColor(iEntity, 0, 0, 255, 255);
}
if (g_cIdentifyLog.BoolValue)
else if (iRagdollC[VictimTeam] == TTT_TEAM_TRAITOR)
{
addArrayTime(iItem);
SetEntityRenderColor(iEntity, 255, 0, 0, 255);
}
}

if (g_cIdentifyLog.BoolValue)
{
addArrayTime(iItem);
}


if (bValid)
{
@@ -3684,7 +3648,7 @@ void InspectBody(int client, int victim, int victimRole, int attacker, int time,
Format(team, sizeof(team), "%T", "Innocents", client);
}

Menu menu = new Menu(BodyMenuHandler);
Menu menu = new Menu(Menu_BodyInspect);
char sBuffer[128];

menu.SetTitle("%T", "Inspected body. The extracted data are the following", client);
@@ -3717,7 +3681,7 @@ void InspectBody(int client, int victim, int victimRole, int attacker, int time,

}

public int BodyMenuHandler(Menu menu, MenuAction action, int client, int itemNum)
public int Menu_BodyInspect(Menu menu, MenuAction action, int client, int itemNum)
{
if (action == MenuAction_End)
{
@@ -135,7 +135,7 @@ public Action Event_Fire(Event event, const char[] name, bool dontBroadcast)
return Plugin_Continue;
}

Action OnWeaponEquip(int client, int weapon)
public Action OnWeaponEquip(int client, int weapon)
{
int iRef = EntIndexToEntRef(weapon);
int iIndex = g_aListHS.FindValue(iRef);
@@ -153,7 +153,7 @@ Action OnWeaponEquip(int client, int weapon)
return Plugin_Handled;
}

Action OnWeaponDrop(int client, int weapon)
public Action OnWeaponDrop(int client, int weapon)
{
int iRef = EntIndexToEntRef(weapon);
int iIndex = g_aListHS.FindValue(iRef);

0 comments on commit 6402e5a

Please sign in to comment.