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

[REQ]AFK slayer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-20-2009 , 23:42   [REQ]AFK slayer
Reply With Quote #1

Hi. Is there an AFK slayer plugin for my HLDS 1.6 amxmodx server? I do not want the plugin to KICK, just slay if an player hasent moved in like 20 seconds from roundstart.

Last edited by Ejziponken; 02-21-2009 at 10:10.
Ejziponken is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 02-21-2009 , 05:54   Re: AFK slayer
Reply With Quote #2

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#define TIME 20.0
new Float:player_origin[3][33];
public plugin_init()
{
     RegisterHam(Ham_Spawn, "player", "e_Spawn", 1);
}
 
public e_Spawn(id)
{
     if(is_user_alive(id))
     {
           pev(id, pev_origin, player_origin[id]);
           set_task(TIME, "check_afk", id);
     }
     return HAM_IGNORED;
}
 
public check_afk(id)
{
     if(is_user_alive(id))
     if(same_origin(id))
     {
     user_kill(id);
     new name[33];
     get_user_name(id, name, 32);
     client_print(0, print_chat, "%s was killed for being an AFK.", name);
     }
}
 
public same_origin(id)
{
       new Float:origin[3];
       pev(id, pev_origin, origin);
       for(new i = 0; i < 3; i++)
             if(origin[i] != player_origin[i][id])
                   return 0;
       return 1;
}
SnoW is offline
Send a message via MSN to SnoW
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-21-2009 , 08:23   Re: AFK slayer
Reply With Quote #3

Quote:
Originally Posted by SnoW View Post
Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#define TIME 20.0
new Float:player_origin[3][33];
public plugin_init()
{
     RegisterHam(Ham_Spawn, "player", "e_Spawn", 1);
}
 
public e_Spawn(id)
{
     if(is_user_alive(id))
     {
           pev(id, pev_origin, player_origin[id]);
           set_task(TIME, "check_afk", id);
     }
     return HAM_IGNORED;
}
 
public check_afk(id)
{
     if(is_user_alive(id))
     if(same_origin(id))
     {
     user_kill(id);
     new name[33];
     get_user_name(id, name, 32);
     client_print(0, print_chat, "%s was killed for being an AFK.", name);
     }
}
 
public same_origin(id)
{
       new Float:origin[3];
       pev(id, pev_origin, origin);
       for(new i = 0; i < 3; i++)
             if(origin[i] != player_origin[i][id])
                   return 0;
       return 1;
}
Thats not working for me. Maby im doing something wrong?

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; These modules will be auto-detected and loaded   ;;
;;  as needed.  You do not need to enable them here ;;
;;  unless you have problems.                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

fun
engine
fakemeta
;geoip
;sockets
;regex
nvault
cstrike
csx
hamsandwich
Code:
; AMX Mod X plugins

; Admin Base - Always one has to be activated
admin.amxx        ; admin base (required for any admin-related)
;admin_sql.amxx        ; admin base - SQL version (comment admin.amxx)

; Basic
admincmd.amxx        ; basic admin console commands
adminhelp.amxx        ; help command for admin console commands
adminslots.amxx        ; slot reservation
multilingual.amxx    ; Multi-Lingual management

; Menus
menufront.amxx        ; front-end for admin menus
cmdmenu.amxx        ; command menu (speech, settings)
plmenu.amxx        ; players menu (kick, ban, client cmds.)
;telemenu.amxx        ; teleport menu (Fun Module required!)
mapsmenu.amxx        ; maps menu (vote, changelevel)
pluginmenu.amxx        ; Menus for commands/cvars organized by plugin

; Chat / Messages
adminchat.amxx        ; console chat commands
antiflood.amxx        ; prevent clients from chat-flooding the server
scrollmsg.amxx        ; displays a scrolling message
imessage.amxx        ; displays information messages
adminvote.amxx        ; vote commands

; Map related
nextmap.amxx        ; displays next map in mapcycle
mapchooser.amxx        ; allows to vote for next map
timeleft.amxx        ; displays time left on map

; Configuration
pausecfg.amxx        ; allows to pause and unpause some plugins
statscfg.amxx        ; allows to manage stats plugins via menu and commands

; Counter-Strike
;restmenu.amxx        ; restrict weapons menu
statsx.amxx        ; stats on death or round end (CSX Module required!)
;miscstats.amxx        ; bunch of events announcement for Counter-Strike
;stats_logging.amxx    ; weapons stats logging (CSX Module required!)

; Enable to use AMX Mod plugins
amxmod_compat.amxx    ; AMX Mod backwards compatibility layer

; Custom - Add 3rd party plugins here
afkslayer.amxx

Last edited by Ejziponken; 02-21-2009 at 10:12.
Ejziponken is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 02-21-2009 , 14:40   Re: [REQ]AFK slayer
Reply With Quote #4

Checked the code and it seemed fine. What you can do is...
Put something like:
Code:
client_print(id, print_chat, "CHECK WORKS");
To the spawn function, when it's setting the task, when check_afk function starts, and finally after the same_origin check. You can change the message little and this way you see where the plugin goes wrong.
SnoW is offline
Send a message via MSN to SnoW
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-21-2009 , 15:25   Re: [REQ]AFK slayer
Reply With Quote #5

Quote:
Originally Posted by SnoW View Post
Checked the code and it seemed fine. What you can do is...
Put something like:
Code:
client_print(id, print_chat, "CHECK WORKS");
To the spawn function, when it's setting the task, when check_afk function starts, and finally after the same_origin check. You can change the message little and this way you see where the plugin goes wrong.

Can u do it for me? I dont know how
Ejziponken is offline
41aaa41
Member
Join Date: Aug 2011
Location: KOCAELİ / TURKEY
Old 06-19-2019 , 04:59   Re: [REQ]AFK slayer
Reply With Quote #6

Hello there .
you can install the on / off command to it?
for exp : afk_slayer "1" on = afk_slayer "0" off


sorry my english is not so good
you understand me
THX FOR HELPing

Last edited by 41aaa41; 06-19-2019 at 05:00.
41aaa41 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-19-2019 , 06:30   Re: [REQ]AFK slayer
Reply With Quote #7

Quote:
Originally Posted by SnoW View Post
Checked the code and it seemed fine. What you can do is...
Put something like:
Code:
client_print(id, print_chat, "CHECK WORKS");
To the spawn function, when it's setting the task, when check_afk function starts, and finally after the same_origin check. You can change the message little and this way you see where the plugin goes wrong.

It's not fine, seems like you have declared player_origin variable incorrect should be
PHP Code:
 new Float:player_origin[33][3]; 
And your plugin that you wrote is not efficient you need to check for a better way for moving.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 17:30.


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