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

Replacement with engine for fakemets


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krystek.
Member
Join Date: May 2022
Old 02-20-2023 , 07:36   Replacement with engine for fakemets
Reply With Quote #1

What can I replace

HTML Code:
register_forward(FM_Touch, "fw_touch");
register_forward(FM_SetModel, "fw_setmodel");
register_forward(FM_UpdateClientData, "fw_updateclientdata", 1);
Using e.g. an engine?
Krystek. is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 02-20-2023 , 10:38   Re: Replacement with engine for fakemets
Reply With Quote #2

For FM_Think, FM_Touch:
PHP Code:
/**
 * Registers a function to be called on a touch action between entities of
 * specified classes.
 *
 * @note The function will be called in the following manner:
 *
 * public touch_handler(touched, toucher)
 *
 *   touched    - Index of entity being touched
 *   toucher    - Index of entity touching
 *
 * @note The callback should return PLUGIN_CONTINUE to ignore the touch,
 *       PLUGIN_HANDLED or higher to block it.
 * @note When returning PLUGIN_HANDLED from the callback, Engine will still fire
 *       other touch functions like the pfn_touch() forward before actually
 *       blocking the touch. To immediately block return PLUGIN_HANDLED_MAIN
 *       instead.
 *
 * @param Touched   Entity classname being touched, "*" or "" for any class
 * @param Toucher   Entity classname touching, "*" or "" for any class
 * @param function  Name of callback function
 *
 * @return          Touch forward id
 */
native register_touch(const Touched[], const Toucher[], const function[]);

/**
 * Registers a function to be called on entity think on all entities of a
 * specified class.
 *
 * @note The function will be called in the following manner:
 *
 * public think_handler(entity)
 *
 *   entity    - Index of entity thinking
 *
 * @note The callback should return PLUGIN_CONTINUE to ignore the think,
 *       PLUGIN_HANDLED or higher to block it.
 * @note When returning PLUGIN_HANDLED from the callback, Engine will still fire
 *       other think functions like the pfn_think() forward before actually
 *       blocking the think. To immediately block return PLUGIN_HANDLED_MAIN
 *       instead.
 *
 * @param Classname    Entity classname to hook
 * @param function    Name of callback function
 *
 * @return             Think forward id
 */
native register_think(const Classname[], const function[]); 
And for UpdateClientData i really don't know... maybe you coud use this one:
PHP Code:
/**
 * Called when a keyvalue pair is sent to an entity.
 *
 * @note Use copy_keyvalue() to retrieve the keyvalue information, and
 *       DispatchKeyVaue() to modify it.
 *
 * @param entid     Entity index
 *
 * @return          PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
 */
forward pfn_keyvalue(entid); 
Try looking into engine.inc

Edit: Since i knew the pfn_keyvalue had nothing to do with what you wanted i still looked and found this:
PHP Code:
/**
 * Retrieves a value from a usercmd struct.
 *
 * @note This native can only be used inside the client_cmdStart() forward. If
 *       it is used outside this forward it will not retrieve any results and
 *       always return 0.
 * @note For a list of valid usercmd entries see the usercmd_* constants in
 *       engine_const.inc
 *
 * @param type  Entry to retrieve from
 * @param ...   Depending on the entry type a different number of
 *              additional parameters should be provided:
 *                 int      - Returns the entry integer value directly, no
 *                            additional parameters required
 *                 float    - Stores the entry float value into the
 *                            variable provided as the second parameter
 *                 vector   - Copies the entry vector to the Float:array[3]
 *                            provided in the second parameter
 *
 * @return      Changes depending on the entry type:
 *                 int      - Returns the entry integer value
 *                 float    - Returns 1
 *                 vector   - Returns 1
 */
native get_usercmd(typeany:...);

/**
 * Sets a value in a usercmd struct.
 *
 * @note This native can only be used inside the client_cmdStart() forward.
 * @note For a list of valid usercmd entries see the usercmd_* constants in
 *       engine_const.inc
 * @note Changes will be immediately reflected in get_usercmd() for all plugins.
 *
 * @param type  Entry to write to
 * @param ...   Depending on the entry type a different additional parameter
 *              should be provided:
 *                 int      - Second parameter should be an integer variable
 *                 float    - Second parameter should be a float variable
 *                 vector   - Second parameter should be a Float:array[3]
 *
 * @noreturn
 */
native set_usercmd(typeany:...); 
Maybe this could work?

Last edited by AnimalMonster; 02-20-2023 at 10:46.
AnimalMonster is offline
Krystek.
Member
Join Date: May 2022
Old 02-20-2023 , 13:00   Re: Replacement with engine for fakemets
Reply With Quote #3

register_forward(FM_UpdateClientData, "fw_updateclientdata", 1);

performs

HTML Code:
public fw_updateclientdata(id, sw, cd_handle) {
	if(user_has_pbgun(id) && cd_handle)
	{
		set_cd(cd_handle, CD_ID, 1);
		get_cd(cd_handle, CD_flNextAttack, nextattack[id]);
		return FMRES_HANDLED;
	}
	return FMRES_IGNORED;
}
Krystek. is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 02-20-2023 , 14:14   Re: Replacement with engine for fakemets
Reply With Quote #4

Quote:
Originally Posted by Krystek. View Post
register_forward(FM_UpdateClientData, "fw_updateclientdata", 1);

performs

HTML Code:
public fw_updateclientdata(id, sw, cd_handle) {
	if(user_has_pbgun(id) && cd_handle)
	{
		set_cd(cd_handle, CD_ID, 1);
		get_cd(cd_handle, CD_flNextAttack, nextattack[id]);
		return FMRES_HANDLED;
	}
	return FMRES_IGNORED;
}
Maybe you could simply just hook PrimaryAttack, check if it is a paintball gun and change the offsets? It would be easier and less memory using.
PHP Code:
#define LINUX_OFFSET_WEAPONS 4
#define LINUX_OFFSET_PLAYER 5
#define m_flNextPrimaryAttack 46 // Weapon
#define m_flNextSecondaryAttack 47 // Weapon
#define m_flTimeWeaponIdle 48 // Weapon
#define m_flNextAttack 83 // Player 

Last edited by AnimalMonster; 02-20-2023 at 14:15.
AnimalMonster is offline
Krystek.
Member
Join Date: May 2022
Old 02-20-2023 , 15:18   Re: Replacement with engine for fakemets
Reply With Quote #5

Quote:
Originally Posted by AnimalMonster View Post
Maybe you could simply just hook PrimaryAttack, check if it is a paintball gun and change the offsets? It would be easier and less memory using.
PHP Code:
#define LINUX_OFFSET_WEAPONS 4
#define LINUX_OFFSET_PLAYER 5
#define m_flNextPrimaryAttack 46 // Weapon
#define m_flNextSecondaryAttack 47 // Weapon
#define m_flTimeWeaponIdle 48 // Weapon
#define m_flNextAttack 83 // Player 

I don't really understand what it's supposed to look like
Krystek. is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 02-20-2023 , 16:52   Re: Replacement with engine for fakemets
Reply With Quote #6

Quote:
Originally Posted by Krystek. View Post
I don't really understand what it's supposed to look like
PHP Code:
new const weaponName[] = "weapon_*" // Here goes one of cs's weapons like weapon_usp or so on

#define m_pPlayer 41

public plugin_init()
{
     
RegisterHam(Ham_CS_Item_DeployweaponName"Weapon_Deploy_Post"1)
}

public 
Weapon_Deploy_Post(item)
{
     static 
idid get_pdata_cbase(itemm_pPlayerLINUX_OFFSET_WEAPON);
     if(
/*Check Not Paintball Gun*/)
          return;

     static 
Float:flGametimeflGametime get_gametime();

     
set_pdata_float(itemm_flNextPrimaryAttackflGametime+/*Wait time attack1*/LINUX_OFFSET_WEAPON)
     
set_pdata_float(itemm_flNextSecondaryAttackflGametime+/*Wait time attack2*/LINUX_OFFSET_WEAPON)
     
set_pdata_float(itemm_flTimeWeaponIdleflGametime+/*Wait till idle*/LINUX_OFFSET_WEAPON)
     
set_pdata_float(idm_flNextAttackflGametime+/*Wait till attack*/LINUX_OFFSET_PLAYER)

AnimalMonster is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 02-20-2023 , 18:37   Re: Replacement with engine for fakemets
Reply With Quote #7

why do you need to trasnfer it at all ? you wont see ANY difference in server performance
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Krystek.
Member
Join Date: May 2022
Old 02-21-2023 , 05:35   Re: Replacement with engine for fakemets
Reply With Quote #8

Quote:
Originally Posted by JocAnis View Post
why do you need to trasnfer it at all ? you wont see ANY difference in server performance
I want to quit FM and see in practice ;)
Krystek. 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 18:00.


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