gurinov

Preventing Rapid Fire Keybind Cheats

Recommended Posts

I had a player on my server a few weeks ago that was firing semi-auto weapons inhumanly fast. I did some research to find out how this was done to devise a way to prevent it. Its done with a special keybind that does several actions at once. It fires, reloads, double swaps weapon to cancel reload, and fires again. This allows a weapon to fire again almost instantly, bypassing the fire rate cap, because the game always thinks this is your first shot. (I'm not going to post the actual bind here, but you could find it if you wanted to do some testing)

Anyway, I wrote a script that prevents this keybind from working. I've tested it on my server and it is 100% effective at stopping it, and mostly unnoticeable to normal players.

I'm attaching the file to this post for download. Hopefully someone finds it useful. A READ-ME is included with instructions.

Attachments:

Anti_Rapid_Fire.zip

TOPIC

Edited by gurinov
  • Like 1

Share this post


Link to post
Share on other sites

Moved to the right forum.

 

Nicely done, really effective way of stopping it. However

init()
{
level waittill("connected", player);
player thread onPlayerSpawned();
}

There is a FOR loop missing there. Also if you want to avoid unecessary threads you can simply thread it in globallogic spawnplayer function.

 

Will take a further look later as I think this can all be reduced to 1 simple function to improve performance.

 

EDIT: does the same job just cheaper.

// Thread me on player connect!
watchReload()
{
	self endon( "disconnect" );

	for( ;; )
	{
		self waittill( "reload_start" );
		
		weap = self GetCurrentWeapon();
		if( WeaponIsBoltAction( weap ) )
			continue;

		AmmoClip = self GetWeaponAmmoClip( weap );
		self SetWeaponAmmoClip( weap, 0 );

		AmmoStock = self GetWeaponAmmoStock( weap );
		self setWeaponAmmoStock( weap,( AmmoStock + AmmoClip ) );
	}
}

 

Edited by leiizko

Share this post


Link to post
Share on other sites
8 hours ago, leiizko said:

Moved to the right forum.

 

Nicely done, really effective way of stopping it. However


init()
{
level waittill("connected", player);
player thread onPlayerSpawned();
}

There is a FOR loop missing there. Also if you want to avoid unecessary threads you can simply thread it in globallogic spawnplayer function.

 

Will take a further look later as I think this can all be reduced to 1 simple function to improve performance.

 

EDIT: does the same job just cheaper.


// Thread me on player connect!
watchReload()
{
	self endon( "disconnect" );

	for( ;; )
	{
		self waittill( "reload_start" );
		
		weap = self GetCurrentWeapon();
		if( WeaponIsBoltAction( weap ) )
			continue;

		AmmoClip = self GetWeaponAmmoClip( weap );
		self SetWeaponAmmoClip( weap, 0 );

		AmmoStock = self GetWeaponAmmoStock( weap );
		self setWeaponAmmoStock( weap,( AmmoStock + AmmoClip ) );
	}
}

 

I am a little confused here

is this a replacement for what he has in _anti_rapidfire.gsc

or is this a stand alone replacement with a new gsc name

the confusing part is the // Thread me on player connect

i do not have a globallogic file so I use _callbacksetup.gsx to call my scripts right after

 level.gametypestarted = true; // so we know that the gametype has been started up

 

Share this post


Link to post
Share on other sites
4 minutes ago, wkuzma said:

I am a little confused here

is this a replacement for what he has in _anti_rapidfire.gsc

or is this a stand alone replacement with a new gsc name

This is a quick rewrite of the original script to a single function / single thread. It does exactly the same job as original script.

 

5 minutes ago, wkuzma said:

the confusing part is the // Thread me on player connect

i do not have a globallogic file so I use _callbacksetup.gsx to call my scripts right after

 level.gametypestarted = true; // so we know that the gametype has been started up

CodeCallback_PlayerConnect()
{
	self endon("disconnect");
	[[level.callbackPlayerConnect]]();
	// THIS
	self thread xyz/zyx::watchReload();
}

 

  • Like 1

Share this post


Link to post
Share on other sites

in using what you posted and naming it watchreload.gsx

and calling it like you said

CodeCallback_PlayerConnect()
{
    self endon("disconnect");
    [[level.callbackPlayerConnect]]();

self thread maps/mp/gametypes::watchreload();

 

I get a script bad syntax  error on

self thread maps/mp/gametypes::watchreload();

Share this post


Link to post
Share on other sites
8 minutes ago, wkuzma said:

self thread maps/mp/gametypes::watchreload();

You didnt declare in which script this function is.

self thread maps\mp\gametypes\SCRIPTNAME::watchreload();

Share this post


Link to post
Share on other sites

oh ok I will try that

in this post you have \  between maps\mp etc in the one I quoted you had /

I will use the one you just posted sine that is how my other scripts run wit the \ in them

Share this post


Link to post
Share on other sites

Thank you I learned something new today

another way to call a script

I used this after I renamed the scipt to watch.gsx

self thread maps\mp\gametypes\watch::watchreload();

and it loaded without error - once again thank you for helping.

 

Share this post


Link to post
Share on other sites

I threaded it in _callbacksetup.gsx

at this loacation

CodeCallback_PlayerConnect()
{
    self endon("disconnect");
    [[level.callbackPlayerConnect]]();

self thread maps\mp\gametypes\watch::watchreload();

I named the file watch.gsx with what leliko posted

 

  • Like 1

Share this post


Link to post
Share on other sites

This is good solution, thank you. But what to do when players have "unlimited" frag and flash grenades? They throw one by one all the time...

Share this post


Link to post
Share on other sites

By any chance do you guys know if this script could work to disable this bind?

bind 1 "weapnext; wait 2; weapnext"

 

this bind help you to shoot faster but I still want to be able to do this manually without binds. Of course it wouldn’t be as fast as using this bind.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.