AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fakemeta for register_impulse? (https://forums.alliedmods.net/showthread.php?t=56669)

Vet 06-18-2007 10:45

Fakemeta for register_impulse?
 
What would be the Fakemeta equivalent for Engine's register_impulse ?
Or client_impulse (whichever works better).

Alka 06-18-2007 10:54

Re: Fakemeta for register_impulse?
 
Code:

// Impulse command issued
    UC_Impulse,        // byte

?
:wink:

VEN 06-18-2007 11:56

Re: Fakemeta for register_impulse?
 
Hook CmdStart and check for UC_Impulse value via get_uc().

Vet 06-18-2007 12:09

Re: Fakemeta for register_impulse?
 
So something like this?
Code:


register_forward(FM_CmdStart, "cl_cmd")
...
public cl_cmd(id, handle, seed)
{
  new impulse = get_uc(handle, UC_Impulse)
  if (impulse == 201) {
    client_print(id, print_chat, "No Spray for You!")
    return FMRES_SUPERCEDE
  }
  return FMRES_IGNORED
}


regalis 06-18-2007 15:17

Re: Fakemeta for register_impulse?
 
looks good :)

Vet 06-18-2007 18:54

Re: Fakemeta for register_impulse?
 
Well that didn't quite work right. The FMRES_SUPERCEDE didn't stop the impulse value. So then I tried using forward_return(FMV_CELL, 0) and that still didn't work.

What finally DID work was setting the UC_Impulse value to 0 before returning with set_uc()
Code:


public cl_cmd(id, handle, seed)
{
new impulse = get_uc(handle, UC_Impulse)
  if (impulse == 201) {
    client_print(id, print_chat, "No Spray for You!")
    set_uc(handle, UC_Impulse, 0)
  }
  return FMRES_HANDLED
}

Thanks !

Owyn 11-24-2007 15:46

Re: Fakemeta for register_impulse?
 
warning: loose indentation on line " if (impulse == 201) {"

-what i forgot?

hlstriker 11-24-2007 16:00

Re: Fakemeta for register_impulse?
 
Just fix your spacing so everything is lined up nicely.

Owyn 11-24-2007 16:02

Re: Fakemeta for register_impulse?
 
uhm..i see nothing wrong with spaces, mb u could show me, cuz i can't get this to work (cuz of "loose indentation")

hlstriker 11-24-2007 16:42

Re: Fakemeta for register_impulse?
 
Post your code and I'll fix it.


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

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