Raised This Month: $32 Target: $400
 8% 

Sprint - Run Faster [Double-Tap System]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 10-30-2013 , 17:29   Sprint - Run Faster [Double-Tap System]
Reply With Quote #1

Plugin Name: Sprint
Plugin Version: 1.2
Plugin Author: akcaliberg

Description


This plugin allows you to sprint by simply double-tapping the forward (W) key. So you can easily run faster.

Once you reached the specified maximum sprint duration limit, you will be slowed down to the normal speed. You can sprint again when the cooldown time has passed.

If you don't complete your sprint time, you can use it later without waiting for cooldown. For example sprint_timemax is set to 5 seconds. And you used only 2 seconds. You can use your remaining 3 seconds instantly whenever you want.

Any advice and suggestions will be appreciated



Cvars:

Code:
sprint_cooldown             "5.0"         // How many seconds do players need to wait to sprint again.
sprint_timemax              "2.5"         // How many seconds can players sprint at once.
sprint_speed                "400.0"       // Sprint speed.
sprint_keylisten_interval   "0.2"         // Maximum double-tap delay time. Maximum seconds between two taps. ( Recommended value is 0.2 No need to change )
sprint_blockjump            "0"           // It blocks sprinting when you jump, so players can't jump onto unreachable places using sprint.
sprint_breathsound          "2"           // Exhausted breathing sound effect. 2: Use emit_sound | 1: Use client_cmd("spk") | 0: No sound effect.
sprint_screenfade_enabled   "1"           // 1: ScreenFade effects for sprinting and exhaustion | 0: No effects.
sprint_screenfade_rgba      "0 20 200 50" // ScreenFade color options for sprinting.
sprint_screenfade_rgba2     "255 0 0 50"  // ScreenFade color options for exhaustion.
1. parameter: Red
2. parameter: Green
3. parameter: Blue
4. parameter: Alpha (Opacity)

sprint_showusage            "1"           // 1: Sends an introduction text about plugin to everyone every 5 minutes | 0: No introduction.
Commands:

Code:
sprint_reloadcvars // Reloads the new cvar values instantly. So you won't need to wait for a new round.
Change Log:
Code:
  • v1.0 *Plugin released.
  • v1.1 +Added exhausted breathing sound. +Added ScreenFade effects.
  • v1.2 *Changed cvar caching system. You had to change the map to update new cvar values before. Now, cvars are updating every round start. So you just need to wait for a new round. +Added sprint_reloadcvars command. +Added this feature. +Added sprint_blockjump cvar. >Fixed spectator sprint bug.

Modules:

Amxmodx
Hamsandwich
Fakemeta

NOTE: Old versions can be found in the Files.zip
Attached Files
File Type: sma Get Plugin or Get Source (Sprint.sma - 2983 views - 7.0 KB)
File Type: zip Files.zip (46.7 KB, 1195 views)

Last edited by akcaliberg; 09-27-2023 at 12:55.
akcaliberg is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 10-30-2013 , 17:42   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #2

This idea is damn good! It's like minecraft!
Keep up the good work!
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 10-30-2013 , 18:01   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #3

Strange, but it does not work for me . I am run normally after double-tapping "W".
I tried up sprint_speed, like 800.0, same.
Phant is offline
Send a message via ICQ to Phant
Old 10-31-2013, 03:09
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: you continue
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 10-31-2013 , 04:45   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #4

Quote:
Originally Posted by Phant View Post
Strange, but it does not work for me . I am run normally after double-tapping "W".
I tried up sprint_speed, like 800.0, same.
It works for me. Maybe you are tapping not fast enough. Try raising up the sprint_keylisten_interval. I will try it again when I get home.
akcaliberg is offline
Old 10-31-2013, 07:19
DonKisgot
This message has been deleted by YamiKaitou. Reason: English Only
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 10-31-2013 , 07:38   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #5

A plugin like this already exist.
But good job anyways

Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fakemeta >
#include < engine >

#define PLUGIN "Sprint Minecraft"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define MAX 32

new const Float:fWeaponsSpeed[ ]	=	{
	000.0,
	250.0, 000.0, 260.0, 250.0, 240.0, 
	250.0, 250.0, 240.0, 250.0, 250.0,                
	250.0, 250.0, 210.0, 240.0, 240.0,    
	250.0, 250.0, 210.0, 250.0, 220.0,              
	230.0, 230.0, 250.0, 210.0, 250.0,            
	250.0, 235.0, 221.0, 250.0, 245.0 
};

enum sprintState {
	SPRINT_OFF ,
	SPRINT_FIRST_FORWARD ,
	SPRINT_NOT_FORWARD ,
	SPRINT_ON
}

new sprintState:	ePlayerState[ MAX + 1 ];	
new Float:			fTimePlayer[ MAX + 1 ];
new Float:			fToFov[ MAX + 1 ];
new Float: 			fTimeFov[ MAX + 1 ];
new Float:			fFovLastUpdate[ MAX + 1 ];
new Float:			fCurrentFov[ MAX + 1 ];

new 	pCvarTimeDelay		=	0 ,
		pCvarSprintSpeed	=	0 ,
		pCvarChance			=	0 ,
		pCvarTimeFov		=	0;

new msgFOV;

public plugin_init() {
	register_plugin( PLUGIN , VERSION , AUTHOR );
	
	RegisterHam( Ham_Killed , "player" , "fwKilled" , 1 );
	RegisterHam( Ham_Player_PreThink , "player" , "fwPreThink" );
	
	register_event( "CurWeapon" , "CurWeapon" , "be" , "1=1" );
	
	pCvarTimeDelay		=	register_cvar( "sprintMinecraft_delay" , "0.5" );
	pCvarSprintSpeed	=	register_cvar( "sprintMinecraft_speed" , "310.0" );
	pCvarChance			=	register_cvar( "sprintMinecraft_change" , "1" );
	pCvarTimeFov		=	register_cvar( "sprintMinecraft_fovtime" , "0.2" );
	
	msgFOV 				= 	get_user_msgid( "SetFOV" );
}

public client_connect( id ){
	cleanInformation( id );
	fTimeFov[ id ]		=	0.0;
}

public client_disconnect( id ){
	cleanInformation( id );
	fTimeFov[ id ]		=	0.0;
}

public fwPreThink( id ){
	if( !is_user_alive( id ) || pev( id , pev_maxspeed ) == 1.0 ){ //in freezetime player have 1.0 maxspeed
		return PLUGIN_CONTINUE;
	}
	
	if( fTimeFov[ id ] != 0.0 ){
		if( fTimeFov[ id ] < get_gametime( ) ){
			fTimeFov[ id ]	=	0.0;
		}
		else{		
			fCurrentFov[ id ]	+=	( get_gametime( ) - fFovLastUpdate[ id ] ) * fToFov[ id ];
			
			set_pev( id , pev_fov , fCurrentFov[ id ] );
			
			message_begin( MSG_ONE , msgFOV, { 0 , 0 , 0 }, id );
			write_byte( floatround( fCurrentFov[ id ] ) );
			message_end( );
			
			fFovLastUpdate[ id ]	=	get_gametime( );
		}
	}
	
	new iButton		=	pev( id , pev_button );
	new iOldButton	=	pev( id , pev_oldbuttons );
	
	switch( ePlayerState[ id ] ){
		case SPRINT_ON : {
			if( !( iButton & IN_FORWARD ) ){
				sprintOff( id );
			}
		}
		case SPRINT_OFF : {
			if( iButton & IN_FORWARD && !( iOldButton & IN_FORWARD ) ){
				fTimePlayer[ id ]	=	get_gametime();
				ePlayerState[ id ]	=	SPRINT_FIRST_FORWARD;
			}
		}
		case SPRINT_FIRST_FORWARD : {
			if( !checkTime( id ) ){
				cleanInformation( id );
				
				return PLUGIN_CONTINUE;
			}
			
			if( !( iButton & IN_FORWARD ) ){
				ePlayerState[ id ]	=	SPRINT_NOT_FORWARD;
			}
		}
		case SPRINT_NOT_FORWARD : {
			if( !checkTime( id ) ){
				cleanInformation( id );
				
				return PLUGIN_CONTINUE;
			}
			
			if( iButton & IN_FORWARD ){
				if( random_num( 0 , get_pcvar_num( pCvarChance ) ) != 0 ){
					cleanInformation( id ) ;
				}
				else{
					sprintOn( id );
				}
			}
		}
	}
	
	return PLUGIN_CONTINUE;
}

moveTo( id , Float: fFov , Float: fTime ){
	fCurrentFov[ id ]		=	float( pev( id , pev_fov ) );
	
	fTimeFov[ id ]			=	get_gametime( ) + fTime;
	fToFov[ id ]			=	( fFov - fCurrentFov[ id ] ) / fTime;
	
	fFovLastUpdate[ id ]	=	get_gametime( );
}

cleanInformation( id ){
	fTimePlayer[ id ]	=	0.0;
	ePlayerState[ id ]	=	SPRINT_OFF;
}

bool: checkTime( id ){
	return ( get_gametime() - fTimePlayer[ id ] <= get_pcvar_float( pCvarTimeDelay ) );
}

sprintOn( id ){
	ePlayerState[ id ]	=	SPRINT_ON;
	fTimePlayer[ id ]	=	0.0;
	
	set_pev( id , pev_maxspeed , get_pcvar_float( pCvarSprintSpeed ) );
	
	engfunc( EngFunc_SetClientMaxspeed , id , get_pcvar_float( pCvarSprintSpeed ) );
	
	moveTo( id , 100.0 , get_pcvar_float( pCvarTimeFov ) );
}

sprintOff( id ){
	ePlayerState[ id ]	=	SPRINT_OFF;
	fTimePlayer[ id ]	=	0.0;
	
	set_pev( id , pev_maxspeed , fWeaponsSpeed[ get_user_weapon( id ) ] );
	
	if( is_user_alive( id ) ){
		engfunc( EngFunc_SetClientMaxspeed , id , fWeaponsSpeed[ get_user_weapon( id ) ] );
	}
	
	moveTo( id , 90.0 , get_pcvar_float( pCvarTimeFov ) );
}

public fwKilled( id ){
	if( is_user_alive( id ) ){
		return HAM_IGNORED;
	}
	
	sprintOff( id )
	
	return HAM_IGNORED;
}

public CurWeapon( id ){
	if( !is_user_alive( id ) || ePlayerState[ id ] != SPRINT_ON ){
		return PLUGIN_CONTINUE;
	}
	
	set_pev( id , pev_maxspeed , get_pcvar_float( pCvarSprintSpeed ) );
	
	return PLUGIN_CONTINUE;
}
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.

Last edited by ironskillz1; 10-31-2013 at 07:40.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 10-31-2013 , 08:12   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #6

Isn't working for me too.
__________________
Kia is offline
jingojang
Senior Member
Join Date: Feb 2010
Location: The Moon
Old 10-31-2013 , 08:58   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #7

Me neither.
__________________
jingojang is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 10-31-2013 , 08:59   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #8

Sorry guys. I attached the wrong sma accidentally.

Now, it works.

Quote:
Originally Posted by ironskillz1 View Post
A plugin like this already exist.
But good job anyways
I searched, but I couldn't find any sprint plugin like mine until you posted it here.

I searched your plugins name, still can't find


Thanks for your replies. I will add a video tonight. I have to go now.

Last edited by akcaliberg; 10-31-2013 at 09:06.
akcaliberg is offline
norbi1952
Junior Member
Join Date: Aug 2013
Old 10-31-2013 , 09:09   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #9

Quote:
Originally Posted by akcaliberg View Post
I searched your plugins name, still can't find
This plugin was made more than year ago ;)

http://amxx.pl/topic/87715-sprint-minecraft/
norbi1952 is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 10-31-2013 , 09:59   Re: Sprint - Run Faster [Double-Tap System]
Reply With Quote #10

Working fine now, but should it make more clear if someone is sprinting, a colored screen for example.
Made a quick video :

__________________

Last edited by Kia; 10-31-2013 at 10:16.
Kia 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 00:15.


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