hamsandwich
is it worth the overhead of the hamdsandwich include file if i'm just going to use a single function out of it?
Code:
RegisterHam(Ham_Spawn, "player", ham_atSpawn", 1)Code:
register_event("start", "atSpawn", "a", "1=Round_Start")is this really worth it? (other than simply lines of code) i feel like Ham_Spawn does something quite similar, but i'm not so familiar with hamsandwich. i'd like some expert opinions. |
Re: hamsandwich
Round Start is a log event which is executed when freeze time ends.
Spawn forward taken from HamSandwich is executed when server's engine is spawning a client. For example, if you want to reset some variables for each player at the begin of the round, you should hook Round Start. Of course, Round Start is a forward which is executed once so it should be more faster than HamSandwich's Spawn forwards for each client. |
Re: hamsandwich
but Round Start executes the function at the start, rather than per client. while Ham_Spawn does it per client, as they spawn. yes?
Thus....Round Start would best be used for a server-wide change at spawn. And you'd use Ham_Spawn as the best use for changes to individual clients. i.e. Round Start: use to do like a server-wide, client separate command Code:
clinet_print(0, print_chat, "HamSandwiches for all!")Code:
public Ham_onSpawn(id)which also leads me to the question.....is the overhead of hamsandwich worth the performance increase? i know hamsandwich is a large headerfile, and not all administrators have HS enabled. Or am i just asking pointless questions that really don't matter.....i've noticed you guys put a high value on efficiency, so i'm looking for the best methods here.... Also, when HLTV is placed into the world, does it go through Ham_Spawn? Should i make it a point to exclude HLTV from code being executed on it? |
Re: hamsandwich
Your explanation seems to be alright. Round Start is executed after freeze time ends.
HamSandwich is creating custom forwards which will interract with the game engine. And I could give you an example. PHP Code:
When DoSpawn is executed, your forward registered into your plugin is also executed. If your forward is registered as post, it will be executed after the game forward will be executed. Else, if your forward is registered as pre, it will be executed before the game forward will be executed. And of course, game will execute forward DoSpawn 32 times, and your Ham_OnSpawn forward too. Game will execute forward DoRoundStart once, and your LogEvent_RoundStart forward once. No, HamSandwich and FakeMeta are good extensions to use. Is your choice: HamSandwich with 32 executions or RoundStart with one execution. |
Re: hamsandwich
Thanks so much!
another one....sorry to ask so many questions, but does HLTV go through these spawn functions? or do they just get placed into the world and left to do what they need to do. |
Re: hamsandwich
Now I'm testing difference between HLTV message and Ham Spawn forward, I'm also curious. In three minutes I'll be here editing my post.
HLTV is executed before player spawn post. But, after map change, in first round HLTV is not executed. |
Re: hamsandwich
NEAT! Thanks, man! I really appreciate your help. Learned a few things from you.
+karma |
Re: hamsandwich
TLDR
Round_Start is not an alternative to Ham_Spawn. They are very very different. If you want when a player actually spawns then you should always use Ham_Spawn, no excuses. You should only avoid additional modules if and only if you can already achieve the same exact thing with engine or fun. For spawn, ham sandwich is the only way to do it correctly. |
Re: hamsandwich
Well THAT is a clear cut answer i was looking for. Dually noted.
On another note.....what does "TLDR" mean? [EDIT] Google says Too Long Didn't Read. I assume as much and accept it as such. |
| All times are GMT -4. The time now is 07:41. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.