Quote:
Originally Posted by BAILOPAN
If you write proper code, you won't get errors.
|
Because I cannot predict when someone will get kicked by some AFK plugin the users are using, it means to write "proper code" I should use
ALWAYS in any function I'll write the check
Code:
if (!is_user_connected(id))
return PLUGIN_HANDLED
before I'll use such functions - get_user_name, get_user_team, get_user_weapon etc. Otherwise I may expect some day someone will write me the bug report because these natives will return invalid player. Imagine the plugin is using 10 functions, each with 1 of these natives. Then imagine You have 10 plugins using these natives the same way (10 functions, each using one of these natives). To have "proper code" I need to put 10*10 = 100 is_user_connected checks at the top of each function (well, maybe there are aslo some other natives I should do the same check before using them). It means I need to add in sma 100 times is_user_connected and I'm stilll not sure what function before and how many I need to add that check. Finally probably we will get about 200 times a need to use is_user_connected in sma codes (of these 10 plugins).
What "on Earth" I'm trying to say is this - that check (is_user_connected) should happen inside these natives in some *.cpp files with the result as return PLUGIN_HANDLED. It's because of 2 reasons - 1. I cannot predict all possible situations I should really add them (to be sure - as I wrote above - I should write that check before all these natives - which will look completly crazy in code), 2. Doing it in *dll - will execute it faster than in *amxx.
Another thing - there is something missing even for the native client_disconnect. It looks like inside that forward function in sma I cannot use get_user_name (to say "Our friend Roger left us"), I cannot use cs_get_user_team to count some weapons they can be used for the team the user just left etc. Maybe the problem is - the info about the player is cleared too fast - that's maybe the reason we have the problem when some AFK plugin is used? We do have the id of the player, but we cannot use any info about him (as get_user_xxxxx).
__________________
The Fullpack of podbot mm
V3B22 - 24 apr 2012!!! is available
here.
The All-In-One 3.2a package - 02 jun 2013 (
AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available
here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available
here.