Raised This Month: $ Target: $400
 0% 

Anti-JumpBug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Klavs
Junior Member
Join Date: Oct 2011
Location: Denmark
Old 10-28-2011 , 19:27   Anti-JumpBug
Reply With Quote #1

Hi, I'm Klavs, (New to the forums)



I'm asking if anyone could help me create an Anti-JumpBug Plug-in for Counter-Strike Source (Linux Server if matters + And SourceMod 1.4.)

JumpBug is Defined as jumping REALLY fast in a crouching area, which will Prevent a Zombie (Zombie Mod Reloaded) From getting a Knock-Back. Ofc, There's rules on the server, but ppl tend to break them.


So I've been thinking of a way, to prevent this, and I came to this conclusion.

What if I put a delay on the jump command itself? For Example, A Player would only be able to jump every 0.5 second, If the Player tried to do otherwise, the plug-in would stop Him/Her.
I would Be very happy, if anyone would help me Or learn me how to do it myself (Btw, Watching the scripting tuts tomorrow, It's kinda late atm)

And At Last! Thx For All Your Time, - Klavs
Klavs is offline
Send a message via Skype™ to Klavs
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-29-2011 , 00:27   Re: Anti-JumpBug
Reply With Quote #2

you could do that...

on player jump command, set bool for CanPlayerJump(client) to false and create a timer for 0.5 seconds which will set CanPlayerJump(client) to true.

If player tries to jump when CanPlayerJump(client) is false, then that jump command is ignored.

Don't forget to handle the timer in case the player quits before the timer executes
TnTSCS is offline
thatguyyoulove
Member
Join Date: Nov 2010
Location: North Texas
Old 10-29-2011 , 02:56   Re: Anti-JumpBug
Reply With Quote #3

TnTSCS nailed it on the head.

Klavs, do you have any experience with Sourcepawn or C++?
thatguyyoulove is offline
Klavs
Junior Member
Join Date: Oct 2011
Location: Denmark
Old 10-29-2011 , 06:06   Re: Anti-JumpBug
Reply With Quote #4

Quote:
Originally Posted by thatguyyoulove View Post
TnTSCS nailed it on the head.

Klavs, do you have any experience with Sourcepawn or C++?


Not at all.
Klavs is offline
Send a message via Skype™ to Klavs
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 10-29-2011 , 08:44   Re: Anti-JumpBug
Reply With Quote #5

If someone makes this, release it as an addon for zombiereloaded Back in the days we had the same problem. I guess you could help alot of servers with this plugin
Groger is offline
Klavs
Junior Member
Join Date: Oct 2011
Location: Denmark
Old 10-29-2011 , 09:33   Re: Anti-JumpBug
Reply With Quote #6

Well, I Guess that I'll have to learn how to SourcePawn script then ^^ Anyone got some tutorial videos? And I'll ofc check the forum aswell.

Last edited by Klavs; 10-29-2011 at 10:15. Reason: Details.
Klavs is offline
Send a message via Skype™ to Klavs
thatguyyoulove
Member
Join Date: Nov 2010
Location: North Texas
Old 10-29-2011 , 14:16   Re: Anti-JumpBug
Reply With Quote #7

Start here: http://wiki.alliedmods.net/Category:SourceMod_Scripting and read down through the Timers section. To start you can probably just use Notepad (in Windows) or TextEdit(Mac) to write your code. Save it as jumpbug.sp and go to http://www.sourcemod.net/compiler.php , hit Browse, select the file, and then hit Compile. It will spit out any errors or warnings you may have and/or spit out the compiled file ready for use. I will be able to help you out. Just PM me when you get stuck.
thatguyyoulove is offline
Klavs
Junior Member
Join Date: Oct 2011
Location: Denmark
Old 10-29-2011 , 15:20   Re: Anti-JumpBug
Reply With Quote #8

Quote:
Originally Posted by thatguyyoulove View Post
Start here: http://wiki.alliedmods.net/Category:SourceMod_Scripting and read down through the Timers section. To start you can probably just use Notepad (in Windows) or TextEdit(Mac) to write your code. Save it as jumpbug.sp and go to http://www.sourcemod.net/compiler.php , hit Browse, select the file, and then hit Compile. It will spit out any errors or warnings you may have and/or spit out the compiled file ready for use. I will be able to help you out. Just PM me when you get stuck.

Ok, and thx mate! Oh, I think that'll use Notepad ++ for the coding
Klavs is offline
Send a message via Skype™ to Klavs
Klavs
Junior Member
Join Date: Oct 2011
Location: Denmark
Old 10-30-2011 , 07:45   Re: Anti-JumpBug
Reply With Quote #9

new g_fOldButtons[MAXPLAYERS+1] = { 0, ... }; // Previous frame's button state

public OnGameFrame() {
decl fButtons;
for( new i = 1; i <= MaxClients; i++) {
if (IsClientInGame(i) && IsPlayerAlive(i)) {
fButtons = GetClientButtons(i);
if (fButtons != g_fOldButtons[i]) { // Client buttons have changed.
if (fButtons & IN_JUMP) { // This button US DOWN
if (!(g_fOldButtons[i] & IN_JUMP)) { // This buttons WAS UP last frame.
PlusJump(i); // Button press function
} // This button WAS DOWN last frame as well.
} else { // This button IS UP
if (g_fOldButtons[i] & IN_JUMP) { // This button WAS DOWN last frame.
MinusJump(i); // Button release function
} // This button WAS UP last frame as well
}
g_fOldButtons[i] = fButtons; // Update state for next frame.
} // Client's buttons have not changed this frame.
} // Client is not in the game or is dead/spectating.
}
}
public OnPluginStart()
{
new bool:CanPlayerJump(client)
}
stock PlusJump(client) {
bool:CanPlayerJump(client) = false
CreateTimer(0.5, BlockPlayerJump(client))
PrintToServer("block")
}
public Action:BlockPlayerJump(Handle:timer(client))
{
bool:CanPlayerJump(client) = true
PrintToServer("unblock")
}
stock MinusJump(client) {
// Do stuff
}





This is The code So Far, And these are the errors that I get. Me And my friend "Raze" Can't quite figure out why.


/groups/sourcemod/upload_tmp/textpGsJbj.sp(27) : warning 219: local variable "CanPlayerJump" shadows a variable at a preceding level
/groups/sourcemod/upload_tmp/textpGsJbj.sp(27) : error 001: expected token: ";", but found "("
/groups/sourcemod/upload_tmp/textpGsJbj.sp(27) : error 017: undefined symbol "client"
/groups/sourcemod/upload_tmp/textpGsJbj.sp(27) : warning 221: label name "bool" shadows tag name
/groups/sourcemod/upload_tmp/textpGsJbj.sp(31) : error 022: must be lvalue (non-constant)
/groups/sourcemod/upload_tmp/textpGsJbj.sp(31) : fatal error 127: too many error messages on one line

Last edited by Klavs; 10-30-2011 at 11:59. Reason: Mistype
Klavs is offline
Send a message via Skype™ to Klavs
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-30-2011 , 12:52   Re: Anti-JumpBug
Reply With Quote #10

you should check out the code from Bullet's BunnyStopper plugin and modify it a bit to suit your needs

maybe something like the following:
PHP Code:
#include <sourcemod>
    
#pragma semicolon 1
#define PLUGIN_VERSION "1.0.0"

new bool:CanPlayerJump[MAXPLAYERS+1];
new 
Handle:h_ClientTimer[MAXPLAYERS+1] = INVALID_HANDLE;

public 
OnPluginStart()
{
    
CreateConVar("anti-jumpbug_version"PLUGIN_VERSION"Current version of Anti-JumpBug"FCVAR_PLUGIN FCVAR_REPLICATED FCVAR_NOTIFY);
    
HookEvent("player_jump"Event_Jumper);
}

public 
OnClientPostAdminCheck(client)
{
    
CanPlayerJump[client] = true;
}

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

    if(
CanPlayerJump[client] == false)
        return;

    
CanPlayerJump[client] = false;
    
h_ClientTimer[client] = CreateTimer0.2Timer_CanPlayerJump_Resetclient );

}

public 
Action:Timer_CanPlayerJump_Reset(Handle:timerany:client)
{
    
CanPlayerJump[client] = true;
    
h_ClientTimer[client] = INVALID_HANDLE;
}

public 
OnClientDisconnect(client)
{
    if(
h_ClientTimer[client] != INVALID_HANDLE)
    {
        
KillTimer(h_ClientTimer[client]);
        
h_ClientTimer[client] = INVALID_HANDLE;
    }
}

public 
OnPluginEnd()
{
    
UnhookEvent("player_jump"Event_Jumper);

...:: TnT Edit ::...

Fixed the code, now it compiles forgot to use == instead of =

*** NOTE ***

The above code (and attached plugin) is untested... let me know if it does what you want or not. I set the timer to 0.2 but you can set that to what you want and recompile


...:: TnT Edit ::...

See post #14

Last edited by TnTSCS; 10-30-2011 at 19:44.
TnTSCS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:57.


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