Modificare plugin Slay

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

GLFXa
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 04 Dec 2015, 15:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

01 Aug 2017, 16:44

Salut, imi poate cineva modifica acest plugin sa dea slay doar celor de la echipa TERO?
| Afiseaza codul
#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 != player_origin[id])
                   return 0;
       return 1;
}
RoyalServer
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 0
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 4 times
Been thanked: 46 times

01 Aug 2017, 17:26

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#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);
               cs_get_user_team(id) == CS_TEAM_T 
               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 != player_origin[id])
                   return 0;
       return 1;
}
GLFXa
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 04 Dec 2015, 15:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

01 Aug 2017, 19:13

Merge perfect. Multumesc!
Am o intrebare, se poate implementa in acest plugin ca jucatorii care stau afk mai mult de 10 minute sa primeasca kick, sau pentru treaba asta trebuie sa folosesc alt plugin?
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 0
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 4 times
Been thanked: 46 times

01 Aug 2017, 19:38

| Afiseaza codul
/*
 *
 *	Author:		Cheesy Peteza
 *	Date:		18-Mar-2004
 *
 *
 *	Description:	A generic AFK Kicker that should work with nearly all Half-Life mods.
 *			Tested with Natural-Selection v3.0 beta 3, Counter-Strike 1.6 and Day of Defeat.
 *
 *	Cvars:
 *			mp_afktime 90		Time a player is allowed to be AFK in seconds before they are kicked. (minimum 30 sec)
 *						They time is only accumulated while they are alive.
 *			mp_afkminplayers 8	Minimum number of players required to be on the server before the plugin starts kicking.
 *
 *
 *	Requirements:	AMXModX
 *
 *
 */

#include <amxmodx>

#define MIN_AFK_TIME 30		// I use this incase stupid admins accidentally set mp_afktime to something silly.
#define WARNING_TIME 15		// Start warning the user this many seconds before they are about to be kicked.
#define CHECK_FREQ 5		// This is also the warning message frequency.

new g_oldangles[33][3]
new g_afktime[33]
new bool:g_spawned[33] = {true, ...}

public plugin_init() {
	register_plugin("AFK Kicker","1.0b","Cheesy Peteza") 
	register_cvar("afk_version", "1.0b", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

	register_cvar("mp_afktime", "90")	// Kick people AFK longer than this time
	register_cvar("mp_afkminplayers", "8")	// Only kick AFKs when there is atleast this many players on the server
	set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
	register_event("ResetHUD", "playerSpawned", "be")
}

public checkPlayers() {
	for (new i = 1; i <= get_maxplayers(); i++) {
		if (is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned) {
			new newangle[3]
			get_user_origin(i, newangle)

			if ( newangle[0] == g_oldangles[0] && newangle[1] == g_oldangles[1] && newangle[2] == g_oldangles[2] ) {
				g_afktime += CHECK_FREQ
				check_afktime(i)
			} else {
				g_oldangles[0] = newangle[0]
				g_oldangles[1] = newangle[1]
				g_oldangles[2] = newangle[2]
				g_afktime = 0
			}
		}
	}
	return PLUGIN_HANDLED
}

check_afktime(id) {
	new numplayers = get_playersnum()
	new minplayers = get_cvar_num("mp_afkminplayers")
					
	if (numplayers >= minplayers) {
		new maxafktime = get_cvar_num("mp_afktime")
		if (maxafktime < MIN_AFK_TIME) {
			log_amx("cvar mp_afktime %i is too low. Minimum value is %i.", maxafktime, MIN_AFK_TIME)
			maxafktime = MIN_AFK_TIME
			set_cvar_num("mp_afktime", MIN_AFK_TIME)
		}

		if ( maxafktime-WARNING_TIME <= g_afktime[id] < maxafktime) {
			new timeleft = maxafktime - g_afktime[id]
			client_print(id, print_chat, "[AFK Kicker] You have %i seconds to move or you will be kicked for being AFK", timeleft)
		} else if (g_afktime[id] > maxafktime) {
			new name[32]
			get_user_name(id, name, 31)
			client_print(0, print_chat, "[AFK Kicker] %s was kicked for being AFK longer than %i seconds", name, maxafktime)
			log_amx("%s was kicked for being AFK longer than %i seconds", name, maxafktime)
			server_cmd("kick #%d ^"You were kicked for being AFK longer than %i seconds^"", get_user_userid(id), maxafktime)
		}
	}
}

public client_connect(id) {
	g_afktime[id] = 0
	return PLUGIN_HANDLED
}

public client_putinserver(id) {
	g_afktime[id] = 0
	return PLUGIN_HANDLED
}

public playerSpawned(id) {
	g_spawned[id] = false
	new sid[1]
	sid[0] = id
	set_task(0.75, "delayedSpawn",_, sid, 1)	// Give the player time to drop to the floor when spawning
	return PLUGIN_HANDLED
}

public delayedSpawn(sid[]) {
	get_user_origin(sid[0], g_oldangles[sid[0]])
	g_spawned[sid[0]] = true
	return PLUGIN_HANDLED
}
GLFXa
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 04 Dec 2015, 15:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

01 Aug 2017, 19:43

Ok, nu se vor suprapune cele 2 pluginuri sau ceva de genul, nu?
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 0
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 4 times
Been thanked: 46 times

01 Aug 2017, 19:48

GLFXa wrote:Ok, nu se vor suprapune cele 2 pluginuri sau ceva de genul, nu?
nu are de ce, dar trebuie sa pui alta limita de timp
GLFXa
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 04 Dec 2015, 15:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

02 Aug 2017, 19:07

A k c 3 n 7 wrote:
GLFXa wrote:Ok, nu se vor suprapune cele 2 pluginuri sau ceva de genul, nu?
nu are de ce, dar trebuie sa pui alta limita de timp
Salut, se poate implementa in pluginul de mai sus (AFK kick) ca doar cei cu flag-ul "b" sa primeasca kick automat?
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 0
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 4 times
Been thanked: 46 times

02 Aug 2017, 20:41

| Afiseaza codul
/*
 *
 *	Author:		Cheesy Peteza
 *	Date:		18-Mar-2004
 *
 *
 *	Description:	A generic AFK Kicker that should work with nearly all Half-Life mods.
 *			Tested with Natural-Selection v3.0 beta 3, Counter-Strike 1.6 and Day of Defeat.
 *
 *	Cvars:
 *			mp_afktime 90		Time a player is allowed to be AFK in seconds before they are kicked. (minimum 

30 sec)
 *						They time is only accumulated while they are alive.
 *			mp_afkminplayers 8	Minimum number of players required to be on the server before the plugin starts 

kicking.
 *
 *
 *	Requirements:	AMXModX
 *
 *
 */

#include <amxmodx>

#define MIN_AFK_TIME 30		// I use this incase stupid admins accidentally set mp_afktime to something silly.
#define WARNING_TIME 15		// Start warning the user this many seconds before they are about to be kicked.
#define CHECK_FREQ 5		// This is also the warning message frequency.

#define LEVEL ADMIN_RESERVATION

new g_oldangles[33][3]
new g_afktime[33]
new bool:g_spawned[33] = {true, ...}

public plugin_init() {
	register_plugin("AFK Kicker","1.0b","Cheesy Peteza") 
	register_cvar("afk_version", "1.0b", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

	register_cvar("mp_afktime", "90")	// Kick people AFK longer than this time
	register_cvar("mp_afkminplayers", "8")	// Only kick AFKs when there is atleast this many players on the server
	set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
	register_event("ResetHUD", "playerSpawned", "be")
}

public checkPlayers() {
	for (new i = 1; i <= get_maxplayers(); i++) {
		if (is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned) {
			new newangle[3]
			get_user_origin(i, newangle)

			if ( newangle[0] == g_oldangles[0] && newangle[1] == g_oldangles[1] && newangle[2] == 

g_oldangles[2] ) {
				g_afktime += CHECK_FREQ
				check_afktime(i)
			} else {
				g_oldangles[0] = newangle[0]
				g_oldangles[1] = newangle[1]
				g_oldangles[2] = newangle[2]
				g_afktime = 0
			}
		}
	}
	return PLUGIN_HANDLED
}

check_afktime(id) {
	new numplayers = get_playersnum()
	new minplayers = get_cvar_num("mp_afkminplayers")
					
	if (numplayers >= minplayers) {
		new maxafktime = get_cvar_num("mp_afktime")
		if (maxafktime < MIN_AFK_TIME) {
			log_amx("cvar mp_afktime %i is too low. Minimum value is %i.", maxafktime, MIN_AFK_TIME)
			maxafktime = MIN_AFK_TIME
			set_cvar_num("mp_afktime", MIN_AFK_TIME)
		}

		if ( maxafktime-WARNING_TIME <= g_afktime[id] < maxafktime) {
			new timeleft = maxafktime - g_afktime[id]
			client_print(id, print_chat, "[AFK Kicker] You have %i seconds to move or you will be kicked for being 

AFK", timeleft)
		} else if (g_afktime[id] > maxafktime) {
			new name[32]
			get_user_name(id, name, 31)
			client_print(0, print_chat, "[AFK Kicker] %s was kicked for being AFK longer than %i seconds", name, 

maxafktime)
			log_amx("%s was kicked for being AFK longer than %i seconds", name, maxafktime)
			server_cmd("kick #%d ^"You were kicked for being AFK longer than %i seconds^"", get_user_userid(id), 

maxafktime)
		}
	}
}

public client_connect(id) {

        if( !(get_user_flags(id) & LEVEL) )

	g_afktime[id] = 0
	return PLUGIN_HANDLED
}

public client_putinserver(id) {
	g_afktime[id] = 0
	return PLUGIN_HANDLED
}

public playerSpawned(id) {
	g_spawned[id] = false
	new sid[1]
	sid[0] = id
	set_task(0.75, "delayedSpawn",_, sid, 1)	// Give the player time to drop to the floor when spawning
	return PLUGIN_HANDLED
}

public delayedSpawn(sid[]) {
	get_user_origin(sid[0], g_oldangles[sid[0]])
	g_spawned[sid[0]] = true
	return PLUGIN_HANDLED
}
GLFXa
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 04 Dec 2015, 15:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

02 Aug 2017, 23:58

Primesc urmatoarele erori la compilare:
| Afiseaza codul
kickafk.sma(83) : error 037: invalid string (possibly non-terminated string)
kickafk.sma(83 -- 85) : error 001: expected token: ",", but found "-identifier-"
kickafk.sma(85) : warning 217: loose indentation
kickafk.sma(85) : error 017: undefined symbol "AFK"
kickafk.sma(85) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.
Done.
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 0
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 4 times
Been thanked: 46 times

03 Aug 2017, 00:05

| Afiseaza codul
/*
 *
 *	Author:		Cheesy Peteza
 *	Date:		18-Mar-2004
 *
 *
 *	Description:	A generic AFK Kicker that should work with nearly all Half-Life mods.
 *			Tested with Natural-Selection v3.0 beta 3, Counter-Strike 1.6 and Day of Defeat.
 *
 *	Cvars:
 *			mp_afktime 90		Time a player is allowed to be AFK in seconds before they are kicked. (minimum 30 sec)
 *						They time is only accumulated while they are alive.
 *			mp_afkminplayers 8	Minimum number of players required to be on the server before the plugin starts kicking.
 *
 *
 *	Requirements:	AMXModX
 *
 *
 */

#include <amxmodx>

#define MIN_AFK_TIME 30		// I use this incase stupid admins accidentally set mp_afktime to something silly.
#define WARNING_TIME 15		// Start warning the user this many seconds before they are about to be kicked.
#define CHECK_FREQ 5		// This is also the warning message frequency.

#define LEVEL ADMIN_RESERVATION

new g_oldangles[33][3]
new g_afktime[33]
new bool:g_spawned[33] = {true, ...}

public plugin_init() {
	register_plugin("AFK Kicker","1.0b","Cheesy Peteza") 
	register_cvar("afk_version", "1.0b", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

	register_cvar("mp_afktime", "90")	// Kick people AFK longer than this time
	register_cvar("mp_afkminplayers", "8")	// Only kick AFKs when there is atleast this many players on the server
	set_task(float(CHECK_FREQ),"checkPlayers",_,_,_,"b")
	register_event("ResetHUD", "playerSpawned", "be")
}

public checkPlayers() {
	for (new i = 1; i <= get_maxplayers(); i++) {
		if (is_user_alive(i) && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned) {
			new newangle[3]
			get_user_origin(i, newangle)

			if ( newangle[0] == g_oldangles[0] && newangle[1] == g_oldangles[1] && newangle[2] == g_oldangles[2] ) {
				g_afktime += CHECK_FREQ
				check_afktime(i)
			} else {
				g_oldangles[0] = newangle[0]
				g_oldangles[1] = newangle[1]
				g_oldangles[2] = newangle[2]
				g_afktime = 0
			}
		}
	}
	return PLUGIN_HANDLED
}

check_afktime(id) {
	new numplayers = get_playersnum()
	new minplayers = get_cvar_num("mp_afkminplayers")
					
	if (numplayers >= minplayers) {
		new maxafktime = get_cvar_num("mp_afktime")
		if (maxafktime < MIN_AFK_TIME) {
			log_amx("cvar mp_afktime %i is too low. Minimum value is %i.", maxafktime, MIN_AFK_TIME)
			maxafktime = MIN_AFK_TIME
			set_cvar_num("mp_afktime", MIN_AFK_TIME)
		}

		if ( maxafktime-WARNING_TIME <= g_afktime[id] < maxafktime) {
			new timeleft = maxafktime - g_afktime[id]
			client_print(id, print_chat, "[AFK Kicker] You have %i seconds to move or you will be kicked for being AFK", timeleft)
		} else if (g_afktime[id] > maxafktime) {
			new name[32]
			get_user_name(id, name, 31)
			client_print(0, print_chat, "[AFK Kicker] %s was kicked for being AFK longer than %i seconds", name, maxafktime)
			log_amx("%s was kicked for being AFK longer than %i seconds", name, maxafktime)
			server_cmd("kick #%d ^"You were kicked for being AFK longer than %i seconds^"", get_user_userid(id), maxafktime)
		}
	}
}

public client_connect(id) {

        if( !(get_user_flags(id) & LEVEL) )
	g_afktime[id] = 0
	return PLUGIN_HANDLED
}

public client_putinserver(id) {
	g_afktime[id] = 0
	return PLUGIN_HANDLED
}

public playerSpawned(id) {
	g_spawned[id] = false
	new sid[1]
	sid[0] = id
	set_task(0.75, "delayedSpawn",_, sid, 1)	// Give the player time to drop to the floor when spawning
	return PLUGIN_HANDLED
}

public delayedSpawn(sid[]) {
	get_user_origin(sid[0], g_oldangles[sid[0]])
	g_spawned[sid[0]] = true
	return PLUGIN_HANDLED
}
GLFXa
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 04 Dec 2015, 15:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Contact:

03 Aug 2017, 01:34

Am testat pluginul, dar da kick si la cei fara flag-ul "b".
Ideea sta in felul urmator, vreau ca pluginul sa dea kick doar adminilor care stau afk (pentru ore), de aceea am ales flag-ul b.
User avatar
A k c 3 n 7
Super moderator
Super moderator
Posts: 0
Joined: 25 Aug 2014, 21:31
Detinator Steam: Da
CS Status: who dares wins
SteamID: Jandarmeria
Reputatie: Super moderator
Moderatorul anului 2023
Fost Membru Club eXtreamCS ( o luna )
Fost eXtream Mod
Fost Intermediar
Nume anterior: Sorinel
Fond eXtream: 0
Location: Unknown
Discord: remusakcent
Has thanked: 4 times
Been thanked: 46 times

03 Aug 2017, 01:40

in loc de

Code: Select all

#define LEVEL ADMIN_RESERVATION
pui

Code: Select all

#define LEVEL ADMIN_SLAY
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest