Print multiline messages to clients console before kick
Hacking away at my first ever plugin. One of its functions will be to reserve slots for registered members.
So if a player connects and his steamid isn't in our database, he will be kicked with a standard message in the modal kick dialog. However, I'd like to provide users with additional explanation over several lines in their console (how to register, display their steamid and tell them to use that during registration etc), something like this: PHP Code:
PHP Code:
I would be grateful if someone could prove a link to, or maybe write, an overview of the client join event chain. In what order are these client_* functions executed, and when do the different server+client commands and features become available+ready to be used in plugins? Oh, and I tried searching for similar topics/issues but had little luck, so if there are other threads explaining what I'm missing here, please do post links. Thanks a bunch :) |
Re: Print multiline messages to clients console before kick
Best way is to just test them all. Print something on every client_* and see which prints. You can do this for order by using server_print but there are at least two events that are not guarunteed to happen in any certain order as far as I understand.
|
Re: Print multiline messages to clients console before kick
1 Attachment(s)
Thanks, here are the results of my testing, which leaves me just as clueless. Test-plugin attached. Am I doing something really wrong? I am a total newbie so I may very well be overlooking the obvious..
Server console: Code:
_______________ server_print from plugin_init _________________Code:
----------------- client_print from client_infochanged ------------I tried on different servers, out of about 40 attempts there was 1 single time where I saw the following in my client console. This was early on before I added the server_print()s, and haven't been able to replicate. Code:
********** client_cmd echo from client_connect ******* |
Re: Print multiline messages to clients console before kick
I would not check "is_user_connected(id)". I would server print and include the result of is_user_connected.
Also, client_changeteam and client_spawn are only for NS (Natural Selection). About your last statement: I think that if you are checking is_user_connected() it will return one result most of the time and the other rarely or something of that nature. Admin Reservations in amxmodx use client_authorized to kick clients. Also, as an alternative to using console print you can use this but as I read from the thread it can't be too much text. |
Re: Print multiline messages to clients console before kick
Thanks for helping.
Good points, I implemented those changes but am still at a loss. I found the thread you are referring to before I made this thread - the big difference (IMO) is providing the user with his Steamid in console from where he can copy it directly. It makes it all the more user friendly. Are there any reasons I should avoid solving this by moving the entire block of client_cmd's + kick into a separate function and call it like ~10 seconds delayed using set_task? |
Re: Print multiline messages to clients console before kick
Client console:
Code:
BUILD 4554 SERVER (0 CRC)Code:
* client_connect(1) Time: 2.146843PHP Code:
|
Re: Print multiline messages to clients console before kick
Thank you for your response. It is a bit too complicated for me. I understand approximately what happens there, but not how I can take advantage of it.
Is a forward almost like "extending a class" in other languages? I had some questions in general about such custom "functions", made a thread for it. From what I gather, PreThink gets called every frame? So where do I put my kick message? Or was this merely a display of the event chain? So far I think I'll try to put the console print and kick in a separate function which is called from putinserver with 5-6 seconds delay (only way I can think of). Does that sound OK? Of course I can just test, but I'd like to get it confirmed from someone who knows what they're doing :) |
Re: Print multiline messages to clients console before kick
I'm just showing you a chain of events and the actual times for each event. If you delay 5-6 seconds after client_putinserver(), that should be fine. According to my test, the client begins to receive messages at ~8.4 seconds, and he is "put in server" at ~6.3 seconds.
|
Re: Print multiline messages to clients console before kick
Seems to be working fine, thanks a lot for helping out. I currently have a 2.5 sec delay from putinserver, it has worked every time for me and my testers so far.
|
| All times are GMT -4. The time now is 13:47. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.