Raised This Month: $ Target: $400
 0% 

No lag nightvision


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-03-2019 , 18:22   Re: No lag nightvision
Reply With Quote #1

It's just less typing.
__________________

Last edited by DJEarthQuake; 05-29-2020 at 11:06.
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-05-2019 , 12:50   Re: No lag nightvision
Reply With Quote #2

Quote:
Originally Posted by DJEarthQuake View Post
[I]Use 8 instead of MSG_ONE_UNRELIABLE.
Use 1 instead of MSG_ONE.
No, this is terrible advice. No one will be able to understand what your code does, not even you. You'll say you understand, but if you come back after 2 weeks and look at your source you will not remember what the heck all these numbers mean.

Look:
PHP Code:
message_begin(596, ..) 
If I look at that I have no idea what it does. I need to check the constants and see what 5 is, what 96 is.

On the other hand:
PHP Code:
message_begin(MSG_ONEget_user_msgid("DeathMsg"), ..) 
I understand instantly that the purpose is to send DeathMsg to one player on the reliable channel.

Quote:
The include file already has it typed out.
It has it typed out for you to use it, not hardcode everything and write terrible code.

Quote:
The replacement makes a smaller file size. That uses less CPU. Every little drop of knowledge is essential for your laggin' war bro.
Except you are giving him bad "knowledge". It will not make the file smaller, and even if it did, what in the world file size has to do with CPU usage?
It will use more memory on the hard to store the file, but not more CPU. Think about it this way:
-you have a string made of letter "a" and you do nothing with it. plugin_init is empty.
-you have a string made of one million "a" and you do nothing with it. Will that consume more cpu? Absolutely not. Is the file bigger? Of course.
file size does not translate in any way to CPU usage.

Quote:
Numbers are easier. I use 0,23 all the time for broadcasting temp ents.
How? With pure numbers you have no idea what's going on.

Look at setting offsets: set_pdata_int(id, 116, 1). Can you tell me without googling anything, what this does? You can't.
But if I give you set_pdata_int(id, m_iTeam, _:CS_TEAM_T)? Of course, it sets the team of the player to 1.

Also, what are you going to do if the constant changes? Are you going to update EVERY SINGLE PLUGIN and change the value? That's just asking for unmaintanable code.

Quote:
Such perspective is reminiscent of spaces vs tabs didactic.
No, it's about writing good code that that doesn't break at the slightest change and that can be updated and understood by other people.
__________________

Last edited by HamletEagle; 05-05-2019 at 12:51.
HamletEagle is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-06-2019 , 01:17   Re: No lag nightvision
Reply With Quote #3

Undoubtedly code must be easy to follow and hand down. After rechecking initial post it was discovered that the intended draft rushingly got recreated. I inadvertently omitted the portion that said most would disagree but I occasionally use the numbers as long as there is a comment about the substitution. I can't believe I recommended it.
__________________

Last edited by DJEarthQuake; 05-29-2020 at 11:14.
DJEarthQuake is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-06-2019 , 09:11   Re: No lag nightvision
Reply With Quote #4

Quote:
Originally Posted by DJEarthQuake View Post
Please help me understand. Appreciate your patience. Why the converse logic here?

It's a macro/defined already.
It's a macro/defined in AMXX 1.8.3/1.9, not in 1.8.2 which is the current stable build.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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:16.


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