AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Shift Button pressed ? (https://forums.alliedmods.net/showthread.php?t=303587)

Alexxxxxxxxx 12-13-2017 13:12

Shift Button pressed ?
 
How can i know if a player is pressing L SHIFT button ?

eyal282 12-13-2017 15:05

Re: Shift Button pressed ?
 
Quote:

Originally Posted by Alexxxxxxxxx (Post 2566016)
How can i know if a player is pressing L SHIFT button ?

Unsure but try this:

if(get_user_button(index) & IN_RUN)

DjSoftero 12-13-2017 15:36

Re: Shift Button pressed ?
 
Quote:

Originally Posted by eyal282 (Post 2566037)
Unsure but try this:

if(get_user_button(index) & IN_RUN)

no.

There was a thread about this a month ago, or so. Search

fysiks 12-13-2017 20:59

Re: Shift Button pressed ?
 
The most important thing to understand is that you cannot know what keyboard keys are being pressed. You can only see what commands are being sent to the server. Not every body uses the same keyboard layout.

Alexxxxxxxxx 12-14-2017 12:08

Re: Shift Button pressed ?
 
Quote:

Originally Posted by fysiks (Post 2566095)
The most important thing to understand is that you cannot know what keyboard keys are being pressed. You can only see what commands are being sent to the server. Not every body uses the same keyboard layout.

i am talking about default keyborad binds

alexbomjovem 02-03-2022 14:16

Re: Shift Button pressed ?
 
PHP Code:

if(fm_get_ent_speed(id) < 150)
{
            return 
FMRES_IGNORED;


detect shift velocity

OciXCrom 02-03-2022 15:18

Re: Shift Button pressed ?
 
Quote:

Originally Posted by alexbomjovem (Post 2770438)
PHP Code:

if(fm_get_ent_speed(id) < 150)
{
            return 
FMRES_IGNORED;


detect shift velocity

And what is fm_get_ent_speed?

iceeedr 02-03-2022 19:04

Re: Shift Button pressed ?
 
Quote:

Originally Posted by OciXCrom (Post 2770445)
And what is fm_get_ent_speed?

I believe it is this stock.

PHP Code:

stock Float:fm_get_ent_speed(id)
{
 if(!
pev_valid(id))
  return 
0.0;
 
 static 
Float:vVelocity[3];
 
pev(idpev_velocityvVelocity);
 
 
vVelocity[2] = 0.0;
 
 return 
vector_length(vVelocity);



kww 02-13-2022 11:27

Re: Shift Button pressed ?
 
Quote:

Originally Posted by alexbomjovem (Post 2770438)
PHP Code:

if(fm_get_ent_speed(id) < 150)
{
            return 
FMRES_IGNORED;


detect shift velocity

the code will also be executed at the start of the movement isn't it?

deprale 02-14-2022 00:08

Re: Shift Button pressed ?
 
Quote:

Originally Posted by kww (Post 2771378)
the code will also be executed at the start of the movement isn't it?

this is such a bad way of doing it...
first of all, controllers are a thing (not sure who does that on 1.6 ,but I tried to and you can "shift" even without using +speed because of the analog input), also when you land/jump it's gonna trigger it, or hit an object/wall while running your speed is gonna shift to lower amounts or 0.
there's also +moveup that does influence move speed even if you do not hold shift (+speed)
fps too high or too low is gonna trigger that (jumping/landing with 150+ fps, falling off ledges with less than 40 fps etc for example if u had less than 20 and u land somewhere you will most likely never even trigger this cuz you don't lose that much speed lol)

Getting non-fatal hits on you(especially with awp) will also trigger that most likely.

I guess you could "hack" around it, and code a command that lets players bind it on their shift button, let's say +ability and set their ent speed. But you can also probably just register clcmd +speed (I GUESS? not sure, don't know the amxx sdk that well).

Refer to : https://forums.alliedmods.net/showpo...05&postcount=5


All times are GMT -4. The time now is 10:37.

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