This commit is contained in:
neon 2019-06-02 21:53:41 +02:00
commit 583e4b5fcd
3 changed files with 62 additions and 17 deletions

View File

@ -99,13 +99,17 @@ public Action OnCheatCommand(int client, const char[] command, int argc)
if(client == 0)
return Plugin_Continue;
if(IsClientAuthorized(client) && CheckCommandAccess(client, "", ADMFLAG_CHEATS))
return Plugin_Continue;
if(!argc && (StrEqual(command, "kill") || StrEqual(command, "explode")))
return Plugin_Continue;
return Plugin_Handled;
if(!IsClientAuthorized(client) || !CheckCommandAccess(client, "", ADMFLAG_CHEATS))
return Plugin_Handled;
if(StrEqual(command, "noclip") && IsPlayerAlive(client))
ShowActivity2(client, "[SM] ", "toggled noclip on himself.");
LogAction(client, -1, "\"%L\" used cheat command: \"%s\"", client, command);
return Plugin_Continue;
}
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
@ -116,10 +120,11 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
if(impulse == 100 || impulse == 201)
return Plugin_Continue;
if(IsClientAuthorized(client) && CheckCommandAccess(client, "", ADMFLAG_CHEATS))
return Plugin_Continue;
if(!IsClientAuthorized(client) || !CheckCommandAccess(client, "", ADMFLAG_CHEATS))
return Plugin_Handled;
return Plugin_Handled;
LogAction(client, -1, "\"%L\" used cheat command: \"impulse %d\"", client, impulse);
return Plugin_Continue;
}
stock void MakeCheatCommand(const char[] name)

View File

@ -51,7 +51,7 @@ public void OnPluginStart()
RegAdminCmd("sm_modelscale", Command_ModelScale, ADMFLAG_GENERIC, "sm_modelscale <#userid|name> <scale>");
RegAdminCmd("sm_resize", Command_ModelScale, ADMFLAG_GENERIC, "sm_resize <#userid|name> <scale>");
RegAdminCmd("sm_setmodel", Command_SetModel, ADMFLAG_GENERIC, "sm_setmodel <#userid|name> <modelpath>");
RegAdminCmd("sm_setscore", Command_SetScore, ADMFLAG_GENERIC, "sm_setscore <#userid|name> <value>");
RegAdminCmd("sm_setscore", Command_SetScore, ADMFLAG_GENERIC, "sm_setscore <#userid|name> <(optional +/-) value>");
RegAdminCmd("sm_setdeaths", Command_SetDeaths, ADMFLAG_GENERIC, "sm_setdeaths <#userid|name> <value>");
RegAdminCmd("sm_setmvp", Command_SetMvp, ADMFLAG_GENERIC, "sm_setmvp <#userid|name> <value>");
RegAdminCmd("sm_setteamscore", Command_SetTeamScore, ADMFLAG_GENERIC, "sm_setteamscore <team> <value>");
@ -918,7 +918,7 @@ public Action Command_SetScore(int client, int argc)
{
if(argc < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_setscore <#userid|name> <value>");
ReplyToCommand(client, "[SM] Usage: sm_setscore <#userid|name> <(optional +/-) value>");
return Plugin_Handled;
}
@ -932,25 +932,53 @@ public Action Command_SetScore(int client, int argc)
GetCmdArg(1, sArgs, sizeof(sArgs));
GetCmdArg(2, sArgs2, sizeof(sArgs2));
int iVal = StringToInt(sArgs2);
if((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, 0, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for(int i = 0; i < iTargetCount; i++)
int iMode = 0;
int iVal;
if(StrContains(sArgs2, "+", true) != -1)
{
SetEntProp(iTargets[i], Prop_Data, "m_iFrags", iVal);
iMode = 1;
iVal = StringToInt(sArgs2[1]);
}
else if(StrContains(sArgs2, "-", true) != -1)
{
iMode = 2;
iVal = StringToInt(sArgs2[1]);
}
else
{
iVal = StringToInt(sArgs2);
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Set score to \x04%d\x01 on target \x04%s", iVal, sTargetName);
for(int i = 0; i < iTargetCount; i++)
{
if(iMode == 1)
{
SetEntProp(iTargets[i], Prop_Data, "m_iFrags", GetEntProp(iTargets[i], Prop_Data, "m_iFrags") + iVal);
ShowActivity2(client, "\x01[SM] \x04", "\x01Increased score by \x04%d\x01 on target \x04%s", iVal, sTargetName);
}
else if(iMode == 2)
{
SetEntProp(iTargets[i], Prop_Data, "m_iFrags", GetEntProp(iTargets[i], Prop_Data, "m_iFrags") - iVal);
ShowActivity2(client, "\x01[SM] \x04", "\x01Decreased score by \x04%d\x01 on target \x04%s", iVal, sTargetName);
}
else
{
SetEntProp(iTargets[i], Prop_Data, "m_iFrags", iVal);
ShowActivity2(client, "\x01[SM] \x04", "\x01Set score to \x04%d\x01 on target \x04%s", iVal, sTargetName);
}
}
if(iTargetCount > 1)
LogAction(client, -1, "\"%L\" set score to \"%d\" on target \"%s\"", client, iVal, sTargetName);
LogAction(client, -1, "\"%L\" set score \"%s\" on target \"%s\"", client, sArgs2, sTargetName);
else
LogAction(client, iTargets[0], "\"%L\" set score to \"%d\" on target \"%L\"", client, iVal, iTargets[0]);
LogAction(client, iTargets[0], "\"%L\" set score \"%s\" on target \"%L\"", client, sArgs2, iTargets[0]);
return Plugin_Handled;
}

View File

@ -133,11 +133,18 @@ public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast
bool bAwardZombies = ((g_tMinimalRoundDuration == INVALID_HANDLE) && (hEvent.GetInt("winner") == CS_TEAM_T));
int iAliveHumans;
int iAliveZombies;
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client) && GetClientTeam(client) == CS_TEAM_CT)
{
iAliveHumans++;
}
else if(IsValidClient(client) && GetClientTeam(client) == CS_TEAM_T)
{
iAliveZombies++;
}
}
for (int client = 1; client <= MaxClients; client++)
@ -160,7 +167,12 @@ public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast
}
else if (bAwardZombies && g_bIsZombie[client])
{
if (g_bMotherZM[client])
if (iAliveZombies == 1)
{
LogPlayerEvent(client, "triggered", "ze_z_win_solo");
}
else if (g_bMotherZM[client])
{
char sPlayerEvent[32];
Format(sPlayerEvent, sizeof(sPlayerEvent), "ze_m_win_%d", g_cvarDifficultyZombie.IntValue);