Raised This Month: $ Target: $400
 0% 

register_impulse -> fakemeta ??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-20-2008 , 12:06   register_impulse -> fakemeta ??
Reply With Quote #1

hi, how to convert this string
PHP Code:
register_impulse(); 
to fakemeta


i found in stocks, only this
Quote:
stock EF_RunPlayerMove(const FAKECLIENT, const Float:VIEWANGLES[3], Float:forwardmove, Float:sidemove, Float:upmove, buttons, impulse, msec)

return engfunc(EngFunc_RunPlayerMove, FAKECLIENT, VIEWANGLES, forwardmove, sidemove, upmove, buttons, impulse, msec);
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-20-2008 , 12:12   Re: register_impulse -> fakemeta ??
Reply With Quote #2

register the forward FM_CmdStart, then get value of UC_Impulse

PHP Code:
public CmdStart(iduc_handleseed)
{
    if(
get_uc(uc_handleUC_Impulse) == 100)
    { 
Ham has a forward for impulse, i don't know how to retrieve impulse value.

Code:
	/**
	 * Description:		Called whenever an impulse command is executed.
	 * Forward param:	function(this)
	 * Return type:		None.
	 * Execute params:	ExecuteHam(Ham_Player_ImpulseComands, this);
	 */
	Ham_Player_ImpulseCommands,
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-20-2008 , 12:22   Re: register_impulse -> fakemeta ??
Reply With Quote #3

thanks but, i've tryed to block spray, i can spray, but message also shown, what sprays not allowed

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init () {
    
register_plugin"Spray Blocker""1.0""xPaw" )
    
//register_impulse( 201, "spray" )

    
register_forwardFM_CmdStart"CmdStart" )
}

public 
client_putinserver id )
    
client_printid,print_console,"* Spray's not allowed on this server!^n" )

public 
CmdStart iduc_handleseed ) {
    if( 
get_uc uc_handleUC_Impulse ) == 201 )
    {
        
client_printid,print_center,"Spray's not allowed on this server!" )
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}
/* This way from engine working
public spray(id) {
    client_print(id,print_center,"Spray's not allowed on this server!")
    return PLUGIN_HANDLED
}*/ 
__________________
xPaw is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 09-20-2008 , 12:36   Re: register_impulse -> fakemeta ??
Reply With Quote #4

I'm pretty sure you don't return PLUGIN_HANDLED.

I forgot what the correct return value is, and I can't find it quickly, just do a search.
stupok is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-20-2008 , 12:57   Re: register_impulse -> fakemeta ??
Reply With Quote #5

return PLUGIN_HANDLED has no effect.

Quote:
/* The actual return value of the function, use these instead of PLUGIN_HANDLED etc when
* returning from registered forwards.
*/
#define FMRES_IGNORED 1 // Calls target function, returns normal value
#define FMRES_HANDLED 2 // Tells metamod you did something, still calls target function and returns normal value
#define FMRES_OVERRIDE 3 // Supposed to still call the target function but return your value instead
// however this does not work properly with metamod; use supercede instead.
#define FMRES_SUPERCEDE 4 // Block the target call, and use your return value (if applicable)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-20-2008 , 12:59   Re: register_impulse -> fakemeta ??
Reply With Quote #6

i need to
PHP Code:
return FMRES_SUPERCEDE
right or other ?
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-20-2008 , 13:01   Re: register_impulse -> fakemeta ??
Reply With Quote #7

yep
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-20-2008 , 13:11   Re: register_impulse -> fakemeta ??
Reply With Quote #8

f*ck isnt blocking, going try other retuns

EDIT: omfg! no one is blocking o_O
__________________

Last edited by xPaw; 09-20-2008 at 13:16.
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-20-2008 , 13:12   Re: register_impulse -> fakemeta ??
Reply With Quote #9

Code:
#define PLUGIN_CONTINUE		0
#define PLUGIN_HANDLED		1
#define PLUGIN_HANDLED_MAIN	2
----
#define FMRES_IGNORED	1
#define FMRES_HANDLED	2
#define FMRES_OVERRIDE	3
#define FMRES_SUPERCEDE	4
Just to clarify, you do not have to use these for Fakemeta forwards.
You could have done PLUGIN_HANDLED, but it would return the same as FMRES_IGNORED, which does not do anything to the forwards.
Just letting you know that they are just numbers. Yes, these return values were made to distinguish the different between Fakemeta forwards and other forwards.
I'm being redundant right now, because I can't really say what I mean. I guess what I mean is when you returned PLUGIN_HANDLED, it was not going to affect the forward. Not because it was not a FMRES_* value, but because it was equal to FMRES_IGNORED, which does not affect the forward.
I wanted to make sure you knew the difference.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-20-2008 , 13:23   Re: register_impulse -> fakemeta ??
Reply With Quote #10

Set impulse to 0 et return FMRES_HANDLED work in my flashlight plugin.

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin"Spray Blocker""1.0""xPaw" )
    
register_forward(FM_CmdStart"CmdStart" )
}

/*public client_putinserver ( id )
    client_print( id,print_console,"* Spray's not allowed on this server!^n" )*/
// you can't print a message to player in client_putinserver :)

public CmdStart iduc_handleseed )
{
    if( 
get_uc uc_handleUC_Impulse ) == 201 )
    {
        
set_uc(uc_handleUC_Impulse0)
        
client_printid,print_center,"Spray's not allowed on this server!" )
        return 
FMRES_HANDLED
    
}
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 20:33.


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