[SOLVED]client_disconnect & mysql
hi,
i'm writing a plugin to put a mini live status to db. now i have a problem to delete users stats in db when he left the server. now i want to ask is there a way to delete users data without a loop to see who is not anymore on the server? i tried : on client connect PHP Code:
PHP Code:
|
Re: client_disconnect & mysql
IIRC, you can still get their SteamID in client_disconnect() but remember, you actually have to get the SteamID to use it :).
Edit: Your if() statement will always be false BTW. |
Re: client_disconnect & mysql
omg. damn i forgot to get the steamid :-)))
and i wonder why this will not delete my infos.as debug i tried to insert datas in db stand deleting and i got not steamid in table =)) my bad & ok ill delete the line |
Re: [SOLVED]client_disconnect & mysql
sorry for double post.
i just wanted to ask if is it ok to update the table in register_think fw? EDIT: ok i see it. im around 5 min disconnected from the server but the stats are still updating in db. whats the best time to update the stats? 10 sec? i think its better to do it with task |
Re: [SOLVED]client_disconnect & mysql
It really depends on what you are doing. Definitely not recommended to use any type of think forward. Also, the very last point that you should update is on disconnect (not after). Just going by common sense here.
|
Re: [SOLVED]client_disconnect & mysql
Hmm, I think client_connect() triggers when player is accepted to server while in loading, but if the player cancells in loading the client_disconnect() doesn't trigger unless the player has entered the game.
So, if that's surely true , you should use client_putinserver() for adding to db. You should test it tough, add server prints to console upon connect and disconnect, connect to the server and then cancel while loading. And just a small note: about your team comment, are those numbers from their actual team (like [cs_]get_user_team) ? Because in-game, the spectators are team 3. And about your updating stuff... where do you actually update the stats ? All I see is INSERT and DELETE... because if you're having trouble deleting that when player left, you can do it just fine in the update sequence, just check is_user_connected() (or better: a global variable) and check it before updating then delete player and skip to next one. And if you don't have a updating sequence already, set_task() on 5-30 seconds will do just fine. |
Re: [SOLVED]client_disconnect & mysql
Quote:
it worked perfectly but how i said, i was disconnected from the server but the stats was still @ updating. everytime i refreshed the table, i saw new Speed values in tables. i think it caused by traffic or so :-( Quote:
Connecting Connected Spec Fleer Cather thats point2. i have my own teams. a counter-terrorist can be in team 2 or 3. better said, this willbe changed every round. first round are Ts the team 2 and next round are CTs as team 2 defined. PHP Code:
anyways for first thanks for answers. i think its better to add a cvar for the task to set the update task. |
Re: [SOLVED]client_disconnect & mysql
I've tested that connect/disconnect thing and it's true.
Still, server IS notified if player drops in loading so there's a way to detect that too if you really need "connecting" status... and I belive Orpheu is the one for this. Also, updating stats in the think it's not really a good ideea because think (with all checks for skipping frames and stuff so that it's got a few seconds delay between updates) it's pretty inaccurate because not all players have the same FPS... and players with high fps may lag your server. |
Re: [SOLVED]client_disconnect & mysql
ok, ill try to catch with orpheu.
i made a page to see it. http://www.jva-multigaming.at/catchmod/ << if you check it now you will see im on server but in real im disconnected and this thing is still updating. its realy a bad idea to update the tables in think :-D i wanted to have it in real time. anyways it will now be updated in think ( i have to recode it and upload it on server but you can now test it if you like :-)) ) server deatails in my sign. server pw : test EDIT : here is my speed think PHP Code:
|
Re: [SOLVED]client_disconnect & mysql
Quote:
|
| All times are GMT -4. The time now is 04:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.