-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add bomb code * feat: extract lib code * fix: model * chore: text * chore: rename file * feat: add more options * chore: update version
- Loading branch information
Showing
4 changed files
with
348 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#define Z_TANK 8 | ||
|
||
stock void CheatCommand(int client, const char[] sCommand, const char[] sArguments = "") | ||
{ | ||
static int iFlagBits, iCmdFlags; | ||
iFlagBits = GetUserFlagBits(client); | ||
iCmdFlags = GetCommandFlags(sCommand); | ||
SetUserFlagBits(client, ADMFLAG_ROOT); | ||
SetCommandFlags(sCommand, iCmdFlags & ~FCVAR_CHEAT); | ||
FakeClientCommand(client, "%s %s", sCommand, sArguments); | ||
SetUserFlagBits(client, iFlagBits); | ||
SetCommandFlags(sCommand, iCmdFlags); | ||
} | ||
|
||
stock bool IsPlayerIncapacitated(int client) | ||
{ | ||
return (GetEntProp(client, Prop_Send, "m_isIncapacitated", 1) == 1); | ||
} | ||
|
||
stock bool IsPlayerIncapacitatedAtAll(int client) | ||
{ | ||
return (IsPlayerIncapacitated(client) || IsHangingFromLedge(client)); | ||
} | ||
|
||
stock bool IsHangingFromLedge(int client) | ||
{ | ||
return (GetEntProp(client, Prop_Send, "m_isHangingFromLedge", 1) == 1 || GetEntProp(client, Prop_Send, "m_isFallingFromLedge", 1) == 1); | ||
} | ||
|
||
stock void DisarmPlayer(int client) | ||
{ | ||
for (int slot = 0; slot <= 4; slot++) | ||
{ | ||
int weapon = GetPlayerWeaponSlot(client, slot); | ||
if (weapon != -1) | ||
{ | ||
RemovePlayerItem(client, weapon); | ||
RemoveEntity(weapon); | ||
} | ||
} | ||
} | ||
stock bool IsValidClient(int client) | ||
{ | ||
if (client < 1 || client > MaxClients) return false; | ||
if (!IsClientConnected(client)) return false; | ||
if (!IsClientInGame(client)) return false; | ||
return true; | ||
} | ||
|
||
stock bool IsValidAliveClient(int client) | ||
{ | ||
return (1 <= client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client) && (GetClientTeam(client) == 2)); | ||
} | ||
|
||
stock bool IsValidDeadClient(int client) | ||
{ | ||
return (1 <= client <= MaxClients && IsClientInGame(client) && !IsPlayerAlive(client) && (GetClientTeam(client) == 2)); | ||
} | ||
|
||
stock bool IsTank(int client) | ||
{ | ||
// Check if the client is valid and in-game | ||
if (!IsValidClient(client)) | ||
{ | ||
PrintToServer("[Tank Draw] IsTank: Client %d is not valid", client); | ||
return false; | ||
} | ||
|
||
// Check if the client is actually connected | ||
if (!IsClientConnected(client)) | ||
{ | ||
PrintToServer("[Tank Draw] IsTank: Client %d is not connected", client); | ||
return false; | ||
} | ||
|
||
// Check if the client is on the infected team | ||
if (GetClientTeam(client) != 3) // 3 is typically the infected team in L4D2 | ||
{ | ||
PrintToServer("[Tank Draw] IsTank: Client %d is not on the infected team (Team: %d)", client, GetClientTeam(client)); | ||
return false; | ||
} | ||
if (!HasEntProp(client, Prop_Send, "m_zombieClass")) | ||
{ | ||
return false; | ||
} | ||
|
||
PrintToServer("[Tank Draw] IsTank: Client %d passed all preliminary checks", client); | ||
return (GetEntProp(client, Prop_Send, "m_zombieClass") == Z_TANK); | ||
} | ||
|
||
stock void PlaySoundToAll(const char[] sample) | ||
{ | ||
EmitSoundToAll(sample, SOUND_FROM_PLAYER, SNDCHAN_STATIC, SNDLEVEL_NORMAL, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_NORMAL, -1, NULL_VECTOR, NULL_VECTOR, true, 0.0); | ||
} |
Oops, something went wrong.