AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   JUMP problems (https://forums.alliedmods.net/showthread.php?t=196415)

alfre 09-20-2012 14:29

JUMP problems
 
hello all,i need help.
i edited soccerjam plugin.e.g. when i have ball and i jump and i not press e,it will be a task.
Problem is,that when i hold jump button with ball,shows about 10000 texts..
code :
public Player_Jump(id)
{
new button = entity_get_int(id, EV_INT_button)
new usekey = (button & IN_USE)
if(!usekey && id == ballholder)
client_print(0,print_chat,"TEST")

jimaway 09-20-2012 16:01

Re: JUMP problems
 
how is Player_Jump called?

Liverwiz 09-20-2012 17:45

Re: JUMP problems
 
Quote:

Originally Posted by jimaway (Post 1802970)
how is Player_Jump called?

also show the function hooked to player_jump.

alfre 09-21-2012 06:56

Re: JUMP problems
 
RegisterHam( Ham_Player_Jump, "player", "Player_Jump" )

Liverwiz 09-21-2012 09:05

Re: JUMP problems
 
show the entire function, please.

alfre 09-21-2012 10:14

Re: JUMP problems
 
This code only....
this is in soccerjam (ballholder)..
the problem is in holding,it can be fixed with oldbuttons,but i dont know how to make with !usekey and ballholder
public Player_Jump(id)
{
new button = entity_get_int(id, EV_INT_button)
new usekey = (button & IN_USE)
if(!usekey && id == ballholder)
client_print(0,print_chat,"TEST")

Liverwiz 09-21-2012 11:48

Re: JUMP problems
 
at the end of the function put this line.
Code:

button &= ~IN_JUMP
set_pev(id, pev_buttons, button)

This will make sure you only press jump once by essentially deactivating the jump button from currently pressed buttons.
Its kinda sloppy, but it should work for you.

alfre 09-21-2012 11:57

Re: JUMP problems
 
Quote:

Originally Posted by Liverwiz (Post 1803418)
at the end of the function put this line.
Code:

set_pev(id, pev_buttons, button)
This will make sure you only press jump once by essentially deactivating the jump button from currently pressed buttons.
Its kinda sloppy, but it should work for you.

so like this?
public Player_Jump(id)
{
button &= ~IN_JUMP
new button = entity_get_int(id, EV_INT_button)
new usekey = (button & IN_USE)
if(!usekey && id == ballholder)
set_pev(id, pev_buttons, button)
client_print(0,print_chat,"TEST")

Liverwiz 09-21-2012 12:32

Re: JUMP problems
 
put them at the END. LAST 2 lines of the function.

alfre 09-21-2012 12:56

Re: JUMP problems
 
not working.


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

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