Use the new constants in various place.
This commit is contained in:
@ -39,18 +39,16 @@
|
||||
#define CHECK_FREQ 5 // This is also the warning message frequency.
|
||||
#define CLASS_GESTATE 9
|
||||
|
||||
new g_oldangles[33][3]
|
||||
new g_idletime[33]
|
||||
new bool:g_spawned[33] = {true, ...}
|
||||
new g_class[33] // stored info from the "ScoreInfo" message
|
||||
new g_oldangles[MAX_PLAYERS][3]
|
||||
new g_idletime[MAX_PLAYERS]
|
||||
new bool:g_spawned[MAX_PLAYERS] = {true, ...}
|
||||
new g_class[MAX_PLAYERS] // stored info from the "ScoreInfo" message
|
||||
|
||||
new mp_tournamentmode;
|
||||
new amx_idle_time;
|
||||
new amx_idle_min_players;
|
||||
new amx_idle_ignore_immunity;
|
||||
|
||||
new maxplayers;
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin("Idle Player Remover",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||
|
||||
@ -71,15 +69,12 @@ public plugin_init() {
|
||||
{
|
||||
register_event("ScoreInfo","msgScoreInfo","a")
|
||||
}
|
||||
|
||||
|
||||
maxplayers=get_maxplayers();
|
||||
}
|
||||
|
||||
public checkPlayers() {
|
||||
if (get_pcvar_num(mp_tournamentmode)) return PLUGIN_HANDLED
|
||||
|
||||
for (new i = 1; i <= maxplayers; i++) {
|
||||
for (new i = 1; i <= MaxClients; i++) {
|
||||
if (is_user_alive(i) && g_class[i]!=CLASS_GESTATE && is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i) && g_spawned[i]) {
|
||||
if ( !get_pcvar_num(amx_idle_ignore_immunity) ) {
|
||||
if ( access(i, ADMIN_IMMUNITY) ) continue
|
||||
@ -116,7 +111,7 @@ check_idletime(id) {
|
||||
new timeleft = maxidletime - g_idletime[id]
|
||||
client_print(id, print_chat, "[AMXX] You have %d seconds to move or you will be kicked for being idle", timeleft)
|
||||
} else if (g_idletime[id] > maxidletime) {
|
||||
new name[32]
|
||||
new name[MAX_NAME_LENGTH]
|
||||
get_user_name(id, name, 31)
|
||||
client_print(0, print_chat, "[AMXX] %s was kicked for being idle longer than %d seconds", name, maxidletime)
|
||||
log_amx("%s was kicked for being idle longer than %d seconds", name, maxidletime)
|
||||
|
@ -71,8 +71,8 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
new g_Class[33]; // stored info from the "ScoreInfo" message
|
||||
new g_Team[33];
|
||||
new g_Class[MAX_PLAYERS]; // stored info from the "ScoreInfo" message
|
||||
new g_Team[MAX_PLAYERS];
|
||||
|
||||
new g_ScoreInfo_Class;
|
||||
new g_ScoreInfo_Team;
|
||||
@ -102,7 +102,7 @@ public plugin_init() {
|
||||
|
||||
// clear class info..
|
||||
new i=0;
|
||||
while (i<33) {
|
||||
while (i<MAX_PLAYERS) {
|
||||
g_Class[i]=0;
|
||||
g_Team[i]=-1;
|
||||
i++;
|
||||
@ -152,7 +152,7 @@ stock UTIL_FindCommander() {
|
||||
|
||||
}
|
||||
stock UTIL_IsSpectator(id) {
|
||||
if (id<1||id>get_maxplayers())
|
||||
if (id<1||id>MaxClients)
|
||||
return -1;
|
||||
if (g_Class[id]==PLAYERCLASS_SPECTATOR)
|
||||
return 1;
|
||||
@ -167,7 +167,7 @@ public cmdRandom(id,level,cid) {
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new name[32],name_targ[32];
|
||||
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
|
||||
new auth[32],auth_targ[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_name(player,name_targ,31);
|
||||
@ -182,7 +182,7 @@ public cmdRandom(id,level,cid) {
|
||||
else {
|
||||
new cur=0;
|
||||
new i=1;
|
||||
while (i<get_maxplayers()) {
|
||||
while (i<MaxClients) {
|
||||
if (is_user_connected(i)) {
|
||||
if (!(get_user_flags(i) & ADMIN_IMMUNITY)) {
|
||||
if (g_Team[i] == 0) {
|
||||
@ -193,7 +193,7 @@ public cmdRandom(id,level,cid) {
|
||||
i++;
|
||||
}
|
||||
if (cur) {
|
||||
new name[32],auth[32];
|
||||
new name[MAX_NAME_LENGTH],auth[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_authid(id,auth,31);
|
||||
log_amx("Cmd: ^"%s<%d><%s><>^" random all",name,get_user_userid(id),auth);
|
||||
@ -215,7 +215,7 @@ public randomStep(index) {
|
||||
if (g_Team[index] == 0 && !(get_user_flags(index) & ADMIN_IMMUNITY)) {
|
||||
client_cmd(index, "%s", g_AutoAssignAck);
|
||||
}
|
||||
if (++index > get_maxplayers()) {
|
||||
if (++index > MaxClients) {
|
||||
return PLUGIN_HANDLED_MAIN
|
||||
}
|
||||
}
|
||||
@ -233,7 +233,7 @@ public cmdReadyRoom(id,level,cid) {
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new name[32],name_targ[32];
|
||||
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
|
||||
new auth[32],auth_targ[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_name(player,name_targ,31);
|
||||
@ -248,7 +248,7 @@ public cmdReadyRoom(id,level,cid) {
|
||||
else {
|
||||
new cur=0;
|
||||
new i=1;
|
||||
while (i<get_maxplayers()) {
|
||||
while (i<MaxClients) {
|
||||
if (is_user_connected(i)) {
|
||||
if (UTIL_IsSpectator(i) == 1 || g_Team[i] != 0) {
|
||||
cur++;
|
||||
@ -257,7 +257,7 @@ public cmdReadyRoom(id,level,cid) {
|
||||
i++;
|
||||
}
|
||||
if (cur) {
|
||||
new name[32],auth[32];
|
||||
new name[MAX_NAME_LENGTH],auth[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_authid(id,auth,31);
|
||||
log_amx("Cmd: ^"%s<%d><%s><>^" ready room all",name,get_user_userid(id),auth);
|
||||
@ -279,7 +279,7 @@ public rrStep(index) {
|
||||
if (is_user_connected(index) && g_Team[index]!=0) {
|
||||
client_cmd(index, "%s", g_ReadyRoomAck)
|
||||
}
|
||||
if (++index > get_maxplayers()) {
|
||||
if (++index > MaxClients) {
|
||||
return PLUGIN_HANDLED_MAIN
|
||||
}
|
||||
}
|
||||
@ -300,7 +300,7 @@ public cmdTeamTwo(id,level,cid) {
|
||||
client_print(id,print_chat,"[AMXX] That user is already on team two.");
|
||||
return PLUGIN_HANDLED_MAIN;
|
||||
}
|
||||
new name[32],name_targ[32];
|
||||
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
|
||||
new auth[32],auth_targ[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_name(player,name_targ,31);
|
||||
@ -328,7 +328,7 @@ public cmdTeamOne(id,level,cid) {
|
||||
client_print(id,print_chat,"[AMXX] That user is already on team one.");
|
||||
return PLUGIN_HANDLED_MAIN;
|
||||
}
|
||||
new name[32],name_targ[32];
|
||||
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
|
||||
new auth[32],auth_targ[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_name(player,name_targ,31);
|
||||
@ -350,9 +350,9 @@ public cmdUnComm(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,1))
|
||||
return PLUGIN_HANDLED
|
||||
new comm = UTIL_FindCommander();
|
||||
if (comm>0&&comm<=get_maxplayers()) {
|
||||
if (comm>0&&comm<=MaxClients) {
|
||||
client_cmd(comm, "%s", g_StopCommAck);
|
||||
new name[32],name_targ[32];
|
||||
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
|
||||
new auth[32],auth_targ[32];
|
||||
get_user_name(id,name,31);
|
||||
get_user_name(comm,name_targ,31);
|
||||
|
@ -36,14 +36,14 @@
|
||||
#include <amxmisc>
|
||||
#include <ns>
|
||||
|
||||
new g_menuPosition[33]
|
||||
new g_menuPlayers[33][32]
|
||||
new g_menuPlayersNum[33]
|
||||
new g_menuOption[33]
|
||||
new g_menuSettings[33]
|
||||
new g_menuPosition[MAX_PLAYERS]
|
||||
new g_menuPlayers[MAX_PLAYERS][MAX_PLAYERS]
|
||||
new g_menuPlayersNum[MAX_PLAYERS]
|
||||
new g_menuOption[MAX_PLAYERS]
|
||||
new g_menuSettings[MAX_PLAYERS]
|
||||
|
||||
new g_menuSelect[33][64]
|
||||
new g_menuSelectNum[33]
|
||||
new g_menuSelect[MAX_PLAYERS][64]
|
||||
new g_menuSelectNum[MAX_PLAYERS]
|
||||
|
||||
#define MAX_CLCMDS 24
|
||||
|
||||
@ -325,7 +325,7 @@ public actionBanMenu(id, key)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new name[32], name2[32], authid[32], authid2[32]
|
||||
new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32]
|
||||
|
||||
get_user_name(player, name2, 31)
|
||||
get_user_authid(id, authid, 31)
|
||||
@ -338,8 +338,7 @@ public actionBanMenu(id, key)
|
||||
|
||||
if ( !banTime ) // permanent
|
||||
{
|
||||
new maxpl = get_maxplayers();
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM");
|
||||
}
|
||||
@ -348,8 +347,7 @@ public actionBanMenu(id, key)
|
||||
{
|
||||
new tempTime[32];
|
||||
formatex(tempTime,sizeof(tempTime)-1,"%d",banTime);
|
||||
new maxpl = get_maxplayers();
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
|
||||
}
|
||||
@ -400,7 +398,7 @@ displayBanMenu(id, pos)
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new i
|
||||
new name[32]
|
||||
new name[MAX_NAME_LENGTH]
|
||||
new start = pos * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
@ -491,7 +489,7 @@ public actionSlapMenu(id, key)
|
||||
default:
|
||||
{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new name2[32]
|
||||
new name2[MAX_NAME_LENGTH]
|
||||
|
||||
get_user_name(player, name2, 31)
|
||||
|
||||
@ -502,7 +500,7 @@ public actionSlapMenu(id, key)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new authid[32], authid2[32], name[32]
|
||||
new authid[32], authid2[32], name[MAX_NAME_LENGTH]
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_authid(player, authid2, 31)
|
||||
@ -541,7 +539,7 @@ displaySlapMenu(id, pos)
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new i
|
||||
new name[32], team[4]
|
||||
new name[MAX_NAME_LENGTH], team[4]
|
||||
new start = pos * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
@ -624,7 +622,7 @@ public actionKickMenu(id, key)
|
||||
default:
|
||||
{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
|
||||
new authid[32], authid2[32], name[32], name2[32]
|
||||
new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_authid(player, authid2, 31)
|
||||
@ -658,7 +656,7 @@ displayKickMenu(id, pos)
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new i
|
||||
new name[32]
|
||||
new name[MAX_NAME_LENGTH]
|
||||
new start = pos * 8
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
@ -728,7 +726,7 @@ public actionTeamMenu(id, key)
|
||||
default:
|
||||
{
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new authid[32], authid2[32], name[32], name2[32]
|
||||
new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
|
||||
|
||||
get_user_name(player, name2, 31)
|
||||
get_user_authid(id, authid, 31)
|
||||
@ -762,7 +760,7 @@ displayTeamMenu(id, pos)
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new i, iteam
|
||||
new name[32], team[4]
|
||||
new name[MAX_NAME_LENGTH], team[4]
|
||||
new start = pos * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
@ -843,7 +841,7 @@ public actionClcmdMenu(id, key)
|
||||
|
||||
if (is_user_connected(player))
|
||||
{
|
||||
new command[64], authid[32], name[32], userid[32]
|
||||
new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32]
|
||||
|
||||
copy(command, 63, g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
|
||||
get_user_authid(player, authid, 31)
|
||||
@ -882,7 +880,7 @@ displayClcmdMenu(id, pos)
|
||||
new menuBody[512]
|
||||
new b = 0
|
||||
new i
|
||||
new name[32]
|
||||
new name[MAX_NAME_LENGTH]
|
||||
new start = pos * 7
|
||||
|
||||
if (start >= g_menuPlayersNum[id])
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define MAX_ATTEMPTS 128 // How many times to search in an area for a free space
|
||||
#define BLOCKED_MASKS MASK_PLAYER_STUNNED | MASK_ENSNARED | MASK_ALIEN_EMBRYO
|
||||
|
||||
new Float:g_lastcmdtime[33]
|
||||
new Float:g_lastcmdtime[MAX_PLAYERS]
|
||||
|
||||
new amx_unstuck_frequency;
|
||||
|
||||
|
Reference in New Issue
Block a user