Raised This Month: $12 Target: $400
 3% 

Solved [HELP] Hold 'Shift' to Sprint


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hellmonja
Senior Member
Join Date: Oct 2015
Old 09-22-2017 , 12:31   [HELP] Hold 'Shift' to Sprint
Reply With Quote #1

Hello there. I'm looking to convert this Sprint plugin into something you should hold the 'Shift' key down to use, instead of double tapping the forward command. The problem is I haven't seen any plugin so far that does this kind of thing and I have no idea how. I can a simple button push but I have no idea how to make it work whilst holding down a key. Any ideas? Thanks in advance...
__________________

Last edited by hellmonja; 01-01-2018 at 12:09. Reason: solved...
hellmonja is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 09-22-2017 , 13:04   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #2

PreThink or CmdStart, get user button...
__________________









Last edited by CrazY.; 09-22-2017 at 13:05.
CrazY. is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 09-22-2017 , 13:17   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
PreThink or CmdStart, get user button...
Can you give me an example? Also I often wondered what Pre_Think means. The name is not very obvious like Ham_WeaponReload and the examples I've seen aren't any better...
__________________
hellmonja is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-22-2017 , 13:26   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #4

may I ask what is the IN_* for shifting? like IN_FORWARD
__________________
retired chump

Last edited by DjSoftero; 09-22-2017 at 13:28.
DjSoftero is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 09-22-2017 , 13:28   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #5

Quote:
Originally Posted by DjSoftero View Post
may I ask what is the IN_* for shifting? like IN_FORWARD
Ooh! A clue!...
__________________
hellmonja is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 09-22-2017 , 13:30   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #6

Quote:
Originally Posted by hellmonja View Post
Ooh! A clue!...
kinda . I was trying to make an example for you, but I cant seem to find one:
PHP Code:
#define IN_ATTACK                       (1<<0)
#define IN_JUMP                         (1<<1)
#define IN_DUCK                         (1<<2)
#define IN_FORWARD                      (1<<3)
#define IN_BACK                         (1<<4)
#define IN_USE                          (1<<5)
#define IN_CANCEL                       (1<<6)
#define IN_LEFT                         (1<<7)
#define IN_RIGHT                        (1<<8)
#define IN_MOVELEFT                     (1<<9)
#define IN_MOVERIGHT                    (1<<10)
#define IN_ATTACK2                      (1<<11)
#define IN_RUN                          (1<<12)
#define IN_RELOAD                       (1<<13)
#define IN_ALT1                         (1<<14)
#define IN_SCORE                        (1<<15) 
ALT1? maybe, but doesnt seem logical to me
__________________
retired chump

Last edited by DjSoftero; 09-22-2017 at 13:30.
DjSoftero is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-22-2017 , 13:46   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #7

SHIFT keypress (or +speed that's bound to it by default) is never sent to the server so you can't detect it that way.

There is a way though with detecting if the user moves with <52% of maxspeed (or less speed than maxspeed * cl_movespeedkey which is 0.52 by default) CmdStart if I remember correctly, but it's not 100% precise and sometimes gives false results. I've once created sprint using it a few years ago but I don't know where that code is right now so I don't have a complete example.

Quote:
Originally Posted by DjSoftero View Post
ALT1? maybe, but doesnt seem logical to me
ALT1 is +strafe.

Last edited by klippy; 09-22-2017 at 13:50.
klippy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-22-2017 , 18:55   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #8

You can hook client command +speed... I suppose and do some checks in the function
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-22-2017 at 18:56.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-23-2017 , 02:40   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
You can hook client command +speed... I suppose and do some checks in the function
Look at what Kilppy said.
__________________

Last edited by HamletEagle; 09-23-2017 at 02:43.
HamletEagle is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 09-23-2017 , 12:19   Re: [HELP] Hold 'Shift' to Sprint
Reply With Quote #10

Quote:
Originally Posted by KliPPy View Post
SHIFT keypress (or +speed that's bound to it by default) is never sent to the server so you can't detect it that way.

There is a way though with detecting if the user moves with <52% of maxspeed (or less speed than maxspeed * cl_movespeedkey which is 0.52 by default) CmdStart if I remember correctly, but it's not 100% precise and sometimes gives false results. I've once created sprint using it a few years ago but I don't know where that code is right now so I don't have a complete example.
It sounds kinda messy and not worth doing anyway. However, it struck me when you said "52% of maxspeed". Suppose there is a way to modify the SHIFT's multiplier from 0.52 to, lets say, 2.0?...
__________________
hellmonja is offline
Reply


Thread Tools
Display Modes

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 06:02.


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