Skip to content

Instantly share code, notes, and snippets.

@TriForceX
Last active May 19, 2023 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TriForceX/39d10f92469be6da110336bfac3058f2 to your computer and use it in GitHub Desktop.
Save TriForceX/39d10f92469be6da110336bfac3058f2 to your computer and use it in GitHub Desktop.
[JK2/JKA] Fake Wallhack Command
// Call standardSetBodyAnim function
void StandardSetBodyAnim(gentity_t *self, int anim, int flags);
// Fake Wallhack function (NoClip like)
void Cmd_fakeWallhack_f(gentity_t *ent) {
int animation_number;
char animation[MAX_TOKEN_CHARS]; // Define the argument variable. (the argument 0 is already the first command, in this case "fakewh" the second should be "sit" for example /fakewh sit)
trap_Argv(1, animation, sizeof(animation)); // Set the 1st argument recived through a command
if (trap_Argc() < 2) // Check if the arguments are less than 2 (for example if is not /fakewh sit, he just used /fakewh)
{
trap_SendServerCommand(ent - g_entities, va("print \""
"\n"
"^3Fake Wallhack Command\n"
"^5------\n"
"^7You can use ^5/fakewh <animation>^7\n"
"^7Animations availables:\n"
"^2- ^7sit\n"
"^2- ^7ground\n"
"\n\""));
return;
}
if (!Q_stricmp(animation, "sit")) // Check if the argument 1 is "sit"
{
// Set animation variable
animation_number = BOTH_SIT2;
}
else if (!Q_stricmp(animation, "ground")) // Check if the argument 1 "ground"
{
// Set animation variable
animation_number = BOTH_PROPUP1;
}
else // Text if the argument used does not exist
{
trap_SendServerCommand(ent - g_entities, va("print \"^1The animation ^3%s ^1doesn't exist.\n\"", animation));
return;
}
// Check fakewh on/off to print a message
if (ent->client->fakewh) {
trap_SendServerCommand(ent - g_entities, "print \"Fake Wallhack is ^1OFF\n\"");
}
else {
trap_SendServerCommand(ent - g_entities, va("print \"Fake Wallhack is ^2ON with animation ^3%s.\n\"", animation));
}
//set animation
StandardSetBodyAnim(ent, animation_number, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS);
// Turn fakewh on/off
ent->client->fakewh = !ent->client->fakewh;
// Turn noclip on/off (this is just to try, don't use in final version, look for all 'noclip' references and add a copy for 'fakewh'
ent->client->noclip = !ent->client->noclip;
}
@TriForceX
Copy link
Author

Usage:

// Fake Wallhack command
if (Q_stricmp (cmd, "fakewh") == 0) {
	Cmd_fakeWallhack_f(ent);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment