Share
View previous topicGo downView next topic
avatar
Administrator
Administrator
<b>Posts</b> Posts : 97
<b>Registered</b> Registered : 2014-02-07
<b>Location</b> Location : AEEK OFFICE PunBB Chrome Reputation : 7
Points : 1598
View user profilehttp://aeek.clubme.net

AFK_SLAYER

on Wed Nov 12, 2014 11:22 am
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "AFK_SLAYER"
#define VERSION "1.1"
#define AUTHOR "aEEk.#"
#define TIMP 30.0

new Float:player_origin[33][3];
public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR);
   RegisterHam(Ham_Spawn, "player", "iSpawn", 1);
}

public iSpawn(id)
{
    if(is_user_alive(id))
    {
        set_task(0.5, "get_spawn", id);
    }
    return HAM_IGNORED;
}

public get_spawn(id)
{
    pev(id, pev_origin, player_origin[id]);
    set_task(TIMP, "check_afk", id);
    set_task(10.0, "check_afk20sec", id);
    set_task(20.0, "check_afk10sec", id);
    set_task(25.0, "check_afk5sec", id);
}

public check_afk(id)
{
    if(is_user_alive(id))
    {
      if(get_user_team(id) == 1 || get_user_team(id) == 2) 
      {         
         if(same_origin(id))
         {
         user_kill(id);
         new name[33];
         get_user_name(id, name, 32);
         glchat(0, ".e[GAMELIFE] .v%s .na primit slay pentru ca a era .vAFK.", name);
         }
      }
   }
   //return 0;
}

public check_afk20sec(id)
{
    if(is_user_alive(id))
    {
      if(get_user_team(id) == 1 || get_user_team(id) == 2) 
      {         
         if(same_origin(id))
            {
            new name[33];
            get_user_name(id, name, 32);
            glchat(id, ".e[GAMELIFE] .n Ai .v20 secunde .nsa te misti sau vei primi slay.", name);
         }
      }
   }
   //return 0;
}

public check_afk10sec(id)
{
    if(is_user_alive(id))
    {
      if (get_user_team(id) == 1 || get_user_team(id) == 2) 
      {         
         if(same_origin(id))
            {
            new name[33];
            get_user_name(id, name, 32);
            glchat(id, ".e[GAMELIFE] .n Ai .v10 secunde .nsa te misti sau vei primi slay.", name);
         }
      }
   }
   //return 0;
}

public check_afk5sec(id)
{
    if(is_user_alive(id))
    {
      if (get_user_team(id) == 1 || get_user_team(id) == 2) 
      {         
         if(same_origin(id))
            {
            new name[33];
            get_user_name(id, name, 32);
            glchat(id, ".e[GAMELIFE] .n Ai .v5 secunde .nsa te misti sau vei primi slay.", name);
         }
      }
   }
   //return 0;
}

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


stock glchat( const id, const input[ ], any:... )
{
    new count = 1, gamelife[ 32 ]

    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
   
    replace_all( msg, 190, ".v", "^4" ) // Verde
    replace_all( msg, 190, ".n", "^1" ) // Normal
    replace_all( msg, 190, ".e", "^3" ) // CT-Albastru | T-Rosu
    replace_all( msg, 190, ".x", "^0" ) // Normal-Echipa
   
    if( id ) gamelife[ 0 ] = id; else get_players( gamelife, count, "ch" )
    {
        for( new i = 0; i < count; i++ )
        {
            if( is_user_connected( gamelife[ i ] ) )
            {
                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, gamelife[ i ] )
                write_byte( gamelife[ i ] );
                write_string( msg );
                message_end( );
            }
        }
    }
}

Acest plugin da slay jucatorilor care stau AFK timp de 30 secunde.
Versiune:
1.1

Module necesare:
hamsandwich
fakemeta
cstrike

Sper ca a fost folositor !
View previous topicBack to topView next topic
Permissions in this forum:
You cannot reply to topics in this forum