AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [CS:S/CS:GO] Tube Anti Bhop (for mods like Zombiemod) (https://forums.alliedmods.net/showthread.php?t=237714)

zipcore 03-28-2014 15:03

[CS:S/CS:GO] Tube Anti Bhop (for mods like Zombiemod)
 
This small plugin blocks bhop inside tubes, but allows bhop elsewhere.

PHP Code:

#include <sourcemod>
#include <cstrike>
#include <sdktools>

#pragma semicolon 1

#define PLUGIN_VERSION "1.0"

#define JUMP_COOLDOWN 0.2

public Plugin:myinfo 
{
name "Tube Anti BHop",
author "Zipcore",
description "Stops Bunnyhoppers inside tubes etc.",
version PLUGIN_VERSION,
};

new 
Float:g_fNextJump[MAXPLAYERS+1];

public 
OnPluginStart()
{
HookEvent("player_spawn"Event_PlayerSpawn);
HookEvent("player_jump"Event_Jump);
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new 
client GetClientOfUserId(GetEventInt(event"userid"));

g_fNextJump[client] = GetGameTime();

return 
Plugin_Continue;
}

public 
Action:Event_Jump(Handle:event,const String:name[],bool:dontBroadcast)
{
new 
client GetClientOfUserId(GetEventInt(event"userid"));

g_fNextJump[client] = GetGameTime()+JUMP_COOLDOWN;
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
new 
Float:time GetGameTime();

//Is player allowed to jump
if(buttons IN_JUMP && g_fNextJump[client] > time)
{
buttons &= ~IN_JUMP//block jump
TeleportEntity(clientNULL_VECTORNULL_VECTORFloat:{0.0,0.0,0.0}); //Set speed to zero
return Plugin_Changed;
}

return 
Plugin_Continue;




All times are GMT -4. The time now is 18:33.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.