AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   AFKslay code help (https://forums.alliedmods.net/showthread.php?t=86233)

Ejziponken 02-22-2009 19:41

AFKslay code help
 
This plugin dont work for me and i dont know why, or how to fix it. Its
for HLDS 1.6 with amxmodx. It should slay AFK players on my server when
they havent moved in 20 seconds.


None of the below work.

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;
}


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;
}


Exolent[jNr] 02-22-2009 19:50

Re: AFKslay code help
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#define TIME 20.0
new Float:player_origin[33][3];
public plugin_init()
{
    RegisterHam(Ham_Spawn, "player", "e_Spawn", 1);
}
 
public e_Spawn(id)
{
    if(is_user_alive(id))
    {
          set_task(0.8, "get_spawn", id);
    }
    return HAM_IGNORED;
}

public get_spawn(id)
{
    pev(id, pev_origin, player_origin[id]);
    set_task(TIME, "check_afk", id);
}
 
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[id][i])
                  return 0;
      return 1;
}


Ejziponken 02-22-2009 20:22

Re: AFKslay code help
 
Quote:

Originally Posted by Exolent[jNr] (Post 766968)
Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#define TIME 20.0
new Float:player_origin[33][3];
public plugin_init()
{
    RegisterHam(Ham_Spawn, "player", "e_Spawn", 1);
}
 
public e_Spawn(id)
{
    if(is_user_alive(id))
    {
          set_task(0.8, "get_spawn", id);
    }
    return HAM_IGNORED;
}

public get_spawn(id)
{
    pev(id, pev_origin, player_origin[id]);
    set_task(TIME, "check_afk", id);
}
 
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;
}


Nope, not working. :(

Exolent[jNr] 02-22-2009 22:26

Re: AFKslay code help
 
Fixed.

Ejziponken 02-22-2009 23:46

Re: AFKslay code help
 
Quote:

Originally Posted by Exolent[jNr] (Post 767041)
Fixed.


thx. :D

Ejziponken 02-26-2009 07:17

Re: AFKslay code help
 
hm. Its working now, but somehow its slaying some people in the beginning of a round. :S Maby the AFK "timer/counter" dont start from 0 when its a new round? :S


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

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