Thread: help flags
View Single Post
Foxa
Member
Join Date: Nov 2018
Location: Croatia
Old 07-26-2020 , 05:38   Re: help flags
Reply With Quote #16

Quote:
Originally Posted by Bugsy View Post
@Foxa

1. The steam ID will not always be available at client_connect(). I recommend using client_authorized() if you require the steam ID.
2. Your code is written to print to only those who have the specified admin status/flags but then you use 0 in client_print, which prints to everyone. So everyone would see the same print <number of players> number of times. Change this to the player id.
3. Capture the steam id in a global variable so it can be re-used when the player disconnects. No sense in calling a native that returns the same value twice.
4. Your code would not work if the Flag variable held more than 1 flags.
5. I would add "ch" flags to get_players() to exclude bots/HLTV.
6. 'stock' should not be used within a plugin, only include files.

@1M1e - I would avoid printing the 'connecting' and 'connected' messages, use connected only since you are guaranteed to have steam ID at authorized(). It would be annoying to see the same message back to back for each player.

Spoiler
Yeah I know about all those issues, I literally just copied his code and added the flag thing, figured hey if it worked so far why would it not work anymore.
Anyways, thanks for pointing those things out.

Last edited by Foxa; 07-26-2020 at 05:42.
Foxa is offline