AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Whats wrong with the plugin? (https://forums.alliedmods.net/showthread.php?t=86209)

Ejziponken 02-22-2009 13:01

Whats wrong with the plugin?
 
(worng section, sry.)

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.

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


xPaw 02-22-2009 13:08

Re: Whats wrong with the plugin?
 
wrong section. move to scripting help.

Exolent[jNr] 02-22-2009 14:05

Re: Whats wrong with the plugin?
 
Moved to Scripting Help.

Also, your topic's title must be descriptive. Fix it before posting again.

Bugsy 02-22-2009 15:57

Re: Whats wrong with the plugin?
 
Replace your check_afk with this one and see if it works.

PHP Code:

public check_afk(id)
{
     if(
is_user_alive(id))
     {
          if(
same_origin(id))
          {
               
user_kill(id);
               new 
name[33];
               
get_user_name(idname32);
               
client_print(0print_chat"%s was killed for being an AFK."name);
          }
     }



AntiBots 02-22-2009 16:19

Re: Whats wrong with the plugin?
 
new Float:player_origin[3][33]; --> new Float:player_origin[33][3];

if not here pev(id, pev_origin, player_origin[id]); you bug all the plugin

PHP Code:

for(new 03i++)
    if(
origin[i] != player_origin[id][i])
                   return 
0


Ejziponken 02-22-2009 19:12

Re: Whats wrong with the plugin?
 
Nothing is working. :(

Is this right? :E

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))
    {
          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[id][i])
                      return 0;
      return 1;
}


fysiks 02-22-2009 19:30

Re: Whats wrong with the plugin?
 
Quote:

Originally Posted by Bugsy (Post 766855)
Replace your check_afk with this one and see if it works.

PHP Code:

public check_afk(id)
{
     if(
is_user_alive(id))
     {
          if(
same_origin(id))
          {
               
user_kill(id);
               new 
name[33];
               
get_user_name(idname32);
               
client_print(0print_chat"%s was killed for being an AFK."name);
          }
     }




Ejziponken 02-22-2009 19:34

Re: Whats wrong with the plugin?
 
I tryied that too, still not working. :(

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))
    {
          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[id][i])
                      return 0;
      return 1;
}


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

Re: Whats wrong with the plugin?
 
Topic locked due to title not being changed.
Feel free to repost it, but make sure you use a descriptive topic title.


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

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