Raised This Month: $ Target: $400
 0% 

[ H3LP ] Module hooks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-03-2018 , 14:29   [ H3LP ] Module hooks
Reply With Quote #1

Hello, I'm with a simple doubt. If the module is running in server, all the hooks that I don't have registered is called anyway?

I'm asking this because developers said that "FM_AddToFullPack" causes lag in server, but I see in source-code of the half-life that this is hook called too, so if it's called in source of the game, why cause lag if I register it?

Code:
/* AddToFullPack Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, 0 otherwise state is the server maintained copy of the state info that is transmitted to the client a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc. e and ent are the entity that is being added to the update, if 1 is returned host is the player's edict of the player whom we are sending the update to player is 1 if the ent/e is a player and 0 otherwise pSet is either the PAS or PVS that we previous set up.  We can use it to ask the engine to filter the entity against the PAS or PVS. we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to.  Caching the value is valid in that case, but still only for the current frame */ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ) { // A lot of code }
__________________









Last edited by CrazY.; 07-03-2018 at 15:33.
CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-03-2018 , 16:30   Re: [ H3LP ] Module hooks
Reply With Quote #2

Calling into Pawn VM is what takes most of the processing power, it's not the same as calling a C function, and with AddToFullPack that can happen thousands of times per second. Anyway it's not as bad as people make it seem, just don't do any heavy processing in there.
__________________

Last edited by klippy; 07-03-2018 at 16:31.
klippy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-04-2018 , 04:46   Re: [ H3LP ] Module hooks
Reply With Quote #3

Clarification :-

Dont use alot of natives, this forward has particular natives for just it, try using what you can.

Create static variables instead of new.

Try avoid creating any array inside of it by using bitsum if its achievable.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-04-2018 at 04:47.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply


Thread Tools
Display Modes

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 12:51.


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