Raised This Month: $51 Target: $400
 12% 

AFK Manager


Post New Thread Reply   
 
Thread Tools Display Modes
ainur
Member
Join Date: Mar 2007
Old 09-13-2007 , 02:58   Re: AFK Manager
Reply With Quote #11

good job

bravo ma alka
__________________
ainur is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-13-2007 , 10:52   Re: AFK Manager
Reply With Quote #12

Pretty good work
__________________
M249-M4A1 is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-14-2007 , 00:23   Re: AFK Manager
Reply With Quote #13

Before this gets approved, I would recommend you do the following:

Code:
    pcvar[0] = register_cvar("afk_autocheck", "1");     pcvar[1] = register_cvar("afk_ac_fastmachine", "0");     pcvar[2] = register_cvar("afk_ac_time", "20");     pcvar[3] = register_cvar("afk_ac_immunity", "1");     pcvar[4] = register_cvar("afk_ac_maxafktime", "80");     pcvar[5] = register_cvar("afk_ac_punish_type", "1");     pcvar[6] = register_cvar("afk_menu", "1");     pcvar[7] = register_cvar("afk_ac_bombtime", "20");

This is the first time I've ever seen anyone do this, lol. While there is nothing really wrong with it code wise, it's not the best thing to do. I strongly recommend you use readable variable names, that or have an enumeration for it. For example:

Code:
enum Cvars {      CVAR_AUTOCHECK = 0,      CVAR_FASTMACHINE,      CVAR_ACTIME } new pcvar[Cvars];     pcvar[CVAR_AUTOCHECK] = register_cvar("afk_autocheck", "1"); pcvar[CVAR_FASTMACHINE] = register_cvar("afk_ac_fastmachine", "0"); pcvar[CVAR_ACTIME] = register_cvar("afk_ac_time", "20");

Once again, this is for readability.

On line 107 you declare the array 'Buffer' with a size of 64 cells within the loop. Don't do this, instead declare it outside the loop as so:

Code:
new Buffer[64] for (/* */) {      // etc }
Do this for all other arrays to.

I see you're using the variable player_id within functions to avoid re-declaring them each time. This really isn't a big save on memory, and is bad practice. Use static variables instead within the functions.

That's about all I can see for now. Please make this changes, unless you can provide a reason for why not to them.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-14-2007 , 02:38   Re: AFK Manager
Reply With Quote #14

OK >.>, i've optimized the code, thanks zenith .
About variable player_id, i can't use it as static because i need it in "AfkSubMenu_Handler(...)" too ;)

Ah, okay. I'll check the code when I get home (at school now).
__________________
Still...lovin' . Connor noob! Hello

Last edited by Zenith77; 09-14-2007 at 10:04.
Alka is offline
koloyu
Junior Member
Join Date: May 2007
Location: Gdansk, Poland
Old 09-14-2007 , 04:45   Re: AFK Manager
Reply With Quote #15

Good job

- And what with player recording demo? In old version of Afk Kisss ( http://forums.alliedmods.net/showthread.php?t=14419 ) is ~demo ask ( http://forums.alliedmods.net/attachm...4&d=1133093627 - start line 283)- That's don't work now, but maybe you know how to fix it? ;] Thats really useful tool (imho).
- Maybe add to the cvar afk_menu "0- off, 1- on, 2- on only for admins"
- Add cvar afk_immunity_level (like ptb_immunity_level in http://forums.alliedmods.net/showthread.php?t=26598 ).
- Finnaly here is Polish Lang:
Code:
[pl]
AFK_SPEC = [%s]Gracz %s zostal przeniesiony do Spectatorow, poniewaz byl AFK dluzej niz %d sekund.
AFK_KICK = [%s]Gracz %s zostal wykopany, poniewaz byl AFK dluzej niz %d sekund.
AFK_KICK_RND = [%s]Losowy gracz ze Spectatorow zostal wykopany za bycie AFK.
AFK_MENU_DISABLED = [%s]Menu AFK jest wylaczone!
AFK_BOMB_TRANSFER = [%s]Bomba zostala przekazana innemu graczowi, poniewaz %s jest AFK.
koloyu is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-14-2007 , 05:38   Re: AFK Manager
Reply With Quote #16

Thanks for the translation...

Updated v1.1a
*afk_menu 0(Off) 1(All) 2(Admins).
*Immunity flag check at autocheck afk and spectators.
#define ADMIN_IMMUNITY_FLAG ADMIN_KICK
*If user is recording a demo will not be kicked from spectators,even if is a normal player.

About Afk spec check, is already included when someone is moved because is afk at spectators the players are checked.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-14-2007 , 06:46   Re: AFK Manager
Reply With Quote #17

You should kick spectator who have been AFK for the longest time instead of random, or add a cvar for chose.
ConnorMcLeod is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 09-14-2007 , 09:23   Re: AFK Manager
Reply With Quote #18

german translation
Code:
[de]
AFK_SPEC = [%s]Spieler %s wurde zu den Spectators verschoben, weil er laenger als %d sek. AFK war.
AFK_KICK = [%s]Spieler %s wurde gekickt, weil er laenger als %d sek. AFK war.
AFK_KICK_RND = [%s]Ein Zufaellig ausgewaehlter Spectator wurde gekickt weil er AFK war.
AFK_MENU_DISABLED = [%s]Entschuldige, das AFK Menue ist abgeschaltet!
AFK_BOMB_TRANSFER = [%s]Spieler %s wurde gedroped & verschob die Bombe weil er AFK war.
__________________

Mordekay is online now
koloyu
Junior Member
Join Date: May 2007
Location: Gdansk, Poland
Old 09-14-2007 , 14:57   Re: AFK Manager
Reply With Quote #19

Found bug:
Plugin starts too quickly (starts when connecing- imho must start at player connected). So sometimes (with afk_ac_maxafktime 70) plugin kicks player a few seconds after he's connected (and reading motd/choosing team).
koloyu is offline
manix
Senior Member
Join Date: Mar 2006
Old 09-15-2007 , 07:11   Re: AFK Manager
Reply With Quote #20

Nice Alka

What happens when an AFK player is switched to spectator just before changelevel ? On next map, as AFK, he won't choose any team.

What about add an kick option for all players that don't join a side when they arrive on server ?
manix is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode