GetEntityClassname() and connecting players
I asked about this in the IRC server, but no response.
So I can notice sometimes in the server error logs that some plugins, in this case Engineer pads, are throwing invalid entity errors. PHP Code:
PHP Code:
PHP Code:
|
Re: GetEntityClassname() and connecting players
Maybe call "IsValidEdict" and use "GetEdictClassname".
Also you should check "channel == SNDCHAN_STATIC" before all the other checks since that consumes the least processing power while the others require more and if the channel is different then you just wasted a bunch of CPU time. I would personally also init the variable as "static char className" so it's not constantly created over and over, sound hooks fire very often. |
Re: GetEntityClassname() and connecting players
Quote:
Edit: Ok, i see this in the sourcepawn transition syntax docs: Also note, there is no equivalent of decl in the new declarator syntax. decl is considered to be dangerous and unnecessary. If an array's zero initialization is too costly, consider making it static or global. . Maybe decl should have been kept in some way. |
Re: GetEntityClassname() and connecting players
Some people were using decl wrong and not filling the variable before reading it, so they got unexpected results as it was sometimes filled with garbage. Static does use more memory but its so small its not going to impact. So long as the variable is set before reading using static in intensive functions is fine.
If I remember correctly an edict can be valid while an entity can be invalid, so that's why I recommend the edict check and getting edict classname. |
Re: GetEntityClassname() and connecting players
Quote:
|
All times are GMT -4. The time now is 04:52. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.