View Single Post
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 01-20-2022 , 10:57   Re: need help in optimization [weird coding]
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
Reducing the code size shouldn't be your goal. Do you have a valid reason as to why you want to change the code? If not, leave it as it is.
Maybe you're right.

I had repeating code in some parts of a plugin so i decided to make one stock to call it. Now i just want to make it cleaner to look better. Or I shouldn't aim that?

Quote:
Originally Posted by Natsheh View Post
Pass the string directly no need for reformatting...
PHP Code:
                console_print(players[i], "%s"szOutput

PHP Code:
                console_print(players[i], szOutput
Oh, thanks, i didn't notice it. Just ctrl+c then ctrl+v, sorry

Quote:
Originally Posted by Natsheh View Post
Also no need for using loop to print for each individual player just use index as 0 for all and remove the loops.
agree

Quote:
Originally Posted by Natsheh View Post
Also you can use bitsum values for print destination will be be more easy and reliable, same goes for notify type.

PHP Code:

enum _
:ePrintDestination (<<=1) {
    
PRINT_CHAT     1,
    
PRINT_CONSOLE

Never understood bitsums and related things. Looks like it's worth digging into this thread.


UPD: Is the chat string limit is 192 symbols?
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 01-20-2022 at 11:03.
kww is offline