AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugun: Afk_manager by outkast134 for AMX (https://forums.alliedmods.net/showthread.php?t=6002)

jackflack 09-19-2004 06:25

Plugun: Afk_manager by outkast134 for AMX
 
I took the amx code below and ran it through the .20 web compiler and it seems to work fine.I am however getting an error that is filling my logs up.

Code:
L 09/19/2004 - 02:50:11: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:51:43: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:53:05: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:53:57: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:54:40: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:55:51: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:57:26: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx") L 09/19/2004 - 02:58:40: [AMXX] Run time error 10 on line 222 (plugin "afk_manager.amxx")

Can someone take a look and tell me what to fix so it will stop logging this and swelling my logs.

Also I didn't see this plugin listed anywhere, so if someone wants to make sure its updated and keep it current then by all means. I only posted to get help with it, not to maintain it.

thank you

-jackflack

Code:
/* AMX Mod script. * * [AFK_MANAGER] AFK Plugin for AMXMOD ([email protected]) * * This file is provided as is (no warranties). * */ /* put in server.cfg: * *  enable / disable afk checking when bomb is planted or when hostages are grabbed 0=off 1=on (default 1) *  amx_afkonobj < value > * *  enable / disable afk checking on round end or when player is killed  0=off 1=on (default 1) *  amx_afkcheck  < value > * *  rounds before idler is kicked (default 2) *  amx_afkrounds < value > * *    enable / disable afk resetting if a player was afk but came back 0=off 1=on (default 1) *    amx_resetafk < value > * */ #include <amxmod> #define MAXCLIENTS 32 new afk_pos[33][3] new afk_count[33] new Float:t_respawn[33] new user_money[33] public plugin_init() {     register_plugin("AFK MANAGER","1.0","outkast134 ([email protected])")     register_cvar("amx_afkonobj","1")     register_cvar("amx_afkcheck","1")     register_cvar("amx_afkrounds","2")     register_cvar("amx_resetafk","1")     register_event("RoundTime","round_start", "bc")     register_event("StatusIcon","icon_event", "be", "1=0", "2=buyzone")     register_event("SendAudio", "user_plbomb", "ac", "2&%!MRAD_BOMBPL")     register_event("SendAudio","round_end","ac","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")     register_event("TextMsg","map_restart","ac","2&#Game_C","2&#Game_w")     register_event("DeathMsg","client_death","a")     register_event("DeathMsg","reset_player","a")     register_event("Money","user_touchhost","b","2=1")     register_event("ResetHUD","plr_respawn","b")         new mapname[4]     get_mapname(mapname,3)     if (!equali(mapname,"de_",3)) {         pause ("b","user_plbomb")     } else if (!equali(mapname,"cs_",3)) {         pause ("b","user_touchhost")     } else if (!equali(mapname,"de_",3) || !equali(mapname,"cs_",3)) {         pause ("b","user_plbomb")         pause ("b","user_touchhost")     } } public client_putinserver(id){     afk_pos[id][0] = 0     afk_pos[id][1] = 0     afk_pos[id][2] = 0     afk_count[id] = 0     return PLUGIN_CONTINUE } public client_disconnect(id){     afk_pos[id][0] = 0     afk_pos[id][1] = 0     afk_pos[id][2] = 0     afk_count[id] = 0     return PLUGIN_CONTINUE } public icon_event(id) {     afk_pos[id][0] = 0     afk_pos[id][1] = 0     afk_pos[id][2] = 0     return PLUGIN_CONTINUE } public map_restart() { // resets afk counts when map is restarted     if (get_cvar_num("amx_afkcheck") == 1) {         for(new a = 1; a < MAXCLIENTS + 1; ++a) {             afk_count[a] = 0         }     }     return PLUGIN_CONTINUE } public round_start() { //gets clients coordinates to use with checking for afk later     new roundtime = floatround(get_cvar_float("mp_roundtime") * 60.0)     if (get_cvar_num("amx_afkcheck") == 1 && get_cvar_num("amx_resetafk") == 1 && roundtime == read_data(1)) {         new origin[3]         for(new a = 1; a < MAXCLIENTS + 1; ++a) {             get_user_origin(a,origin,0)             afk_pos[a][0] = origin[0]             afk_pos[a][1] = origin[1]             afk_pos[a][2] = origin[2]         }     }     return PLUGIN_CONTINUE } public register_afk(id){ //checks for afks, registers them, and handles what to do with them     new afk_max = get_cvar_num("amx_afkrounds")     new origin[3]     new authid[32]     new name[32]     get_user_origin(id,origin,0)     if (origin[0] == afk_pos[id][0] && origin[1] == afk_pos[id][1] && origin[2] != 0) { //compare coords with spawn ones         afk_count[id]++         if (afk_count[id] >= afk_max) { // if user has been afk for X rounds straight we will kick them             client_cmd(id,"echo [AFK MANAGER] Kicked due to idling.;disconnect")             get_user_authid(id,authid,31)             get_user_name(id,name,31)             log_message("[AFK MANAGER] %s<%s> kicked due to idling",name,authid)             client_print(0,print_chat,"[AFK MANAGER] %s was kicked being afk too much.",name)             return PLUGIN_HANDLED         } else {             get_user_name(id,name,31)             if (is_user_alive(id)){ //if the user is afk and alive he gets slayed                 user_kill(id,1)                 client_print(0,print_chat,"[AFK MANAGER] %s was slayed for being AFK.",name)             } else {                 client_print(0,print_chat,"[AFK MANAGER] %s was AFK.",name)             }             return PLUGIN_HANDLED         }     }     return PLUGIN_CONTINUE } public reset_player(){ // resets a clients afk count if they were afk but are not anymore     if (get_cvar_num("amx_afkcheck") == 1) {         new killer, victim         killer = read_data(1)         victim = read_data(2)         if (killer != victim && killer){ //make sure there is no worldspawn and that the user didnt kill himself             if (afk_count[killer] > 0){                 afk_count[killer] = 0 //if player gets a kill hes not afk anymore and his count starts over             }         }     }     return PLUGIN_CONTINUE } public round_end() { //checks for afks at rounds end     if (get_cvar_num("amx_afkcheck") == 1) {         for(new a = 1; a < MAXCLIENTS + 1; ++a) {             if (is_user_alive(a)){ // only check the alive players                 return register_afk(a)             }         }     }     return PLUGIN_CONTINUE } public client_death() { // checks to see if player was afk at spawn when killed or if last alive on team     if (get_cvar_num("amx_afkcheck") == 1) {         new killer, victim         killer = read_data(1)         victim = read_data(2)         if (killer != victim && killer){ //make sure that the victim did not kill himself and that it was not a worldspawn             return register_afk(victim)         }         new ctPlayers = 0, tPlayers = 0, team, tToCheck, ctToCheck         for(new a = 1; a < MAXCLIENTS + 1; ++a) {             if(is_user_alive(a)){ //only check alive players for afk                 team = get_user_team(a)                 if (team == 1) {                     tPlayers++                     tToCheck = a                 }                 if (team == 2) {                     ctPlayers++                     ctToCheck = a                 }             }         }         if ( tPlayers == 1 )             return register_afk(tToCheck)         if ( ctPlayers == 1 )             return register_afk(ctToCheck)     }     return PLUGIN_CONTINUE } public user_touchhost(id) { //checks for afks when a player grabs hostages     if (get_cvar_num("amx_afkonobj") == 1) {         new money = read_data(1)         if (money-user_money[id]==150 && t_respawn[id]<get_gametime() ) { //when a player touches a hostage his money increases by incs of 150             for(new a = 1; a < MAXCLIENTS + 1; ++a) {                 if(is_user_alive(a)){ //only check alive players for afk                     return register_afk(a)                 }             }         }         user_money[id] = money //update users money     }     return PLUGIN_CONTINUE } public user_plbomb() { //checks for afks when a player plants the bomb     if (get_cvar_num("amx_afkonobj") == 1) {         for(new a = 1; a < MAXCLIENTS + 1; ++a) {             if(is_user_alive(a)){ //only check alive players for afk                 return register_afk(a)             }         }     }     return PLUGIN_CONTINUE } public plr_respawn(id) //helper function for user_hosttouch     t_respawn[id] = get_gametime() + 15.0

jackflack 09-21-2004 19:51

bump

twistedeuphoria 09-21-2004 19:57

Is that the entire source?

jackflack 09-21-2004 19:59

1 Attachment(s)
Quote:

Originally Posted by twistedeuphoria
Is that the entire source?

yes the entire .sma file.

twistedeuphoria 09-21-2004 20:02

Well....
Code:
 public plr_respawn(id)  t_respawn[id] = get_gametime() + 15.0
should be
Code:
 public plr_respawn(id) {  t_respawn[id] = get_gametime() + 15.0 }

If that doesn't work add debug to the end of it in plugins.ini
Code:

afk_manager.amxx debug
so you can get the correct line number. There is no line 222 :D .

FeuerSturm 09-21-2004 20:03

EDIT:

shit, twistedeuphoria was some seconds faster :(

jackflack 09-21-2004 20:03

ok ill try that... i added the sma file to the post above just incase i posted the orginal wrong.

jackflack 09-21-2004 20:18

ok this is what debug gave me

Code:
L 09/21/2004 - 17:16:30: [AMXX] Run time error 10 (native) on line 102 (plugin "afk_manager.amxx"). L 09/21/2004 - 17:17:16: [AMXX] Run time error 10 (native) on line 102 (plugin "afk_manager.amxx").

twistedeuphoria 09-21-2004 21:15

Try changing
Code:
 user_kill(id,1)
to
Code:
 user_kill(id,"1")
. Don't know if that's the problem but hey.

@FireStorm:lol you coulda left it up.

jackflack 09-21-2004 21:29

Quote:

Originally Posted by twistedeuphoria
Try changing
Code:
 user_kill(id,1)
to
Code:
 user_kill(id,"1")
. Don't know if that's the problem but hey.

@FireStorm:lol you coulda left it up.

when i try and make that change with the webcompiler i get an error

Code:
/home/users/amxmodx/tmp/Lno6QOOY.sma(129) : error 035: argument type mismatch (argument 2)

That occurs when I add the quotes "1"

Code:
user_kill(id,"1")


All times are GMT -4. The time now is 17:18.

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