Raised This Month: $319 Target: $400
 79%   Almost there!

A Author needs to help me. excuse me?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
Senior Member
Join Date: Oct 2018
Location: Turkey
Old 05-26-2021 , 15:20   A Author needs to help me. excuse me?
Reply With Quote #1

I want to make a player who writes a! Idle in an afk manager plugin become afk after waiting a certain second, but I couldn't. Can anyone who knows the codes help me?

I coded something like this.

PHP Code:
public Action Idle(int clientint args)
{
    
     
CreateTimer(15.0Idle_TIMER_REPEAT);
     
     
PrintHintText("[RegionZ] \n After 15 seconds you will be afk.");
    
    if (
GetClientTeam(client) != 1)
    {
        if (
IsPlayerAlive(client))
        {
            
ChangeClientTeam(client1);
            
ForcePlayerSuicide(client);
            
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 has moved to Spectator team."client);
            
PrintToServer("\x04[\x05AFK Manager\x04]\x01 Player '%N' has moved to Spectator team."client);
        }
        else
        {
            
PrintToChat(client"\x04[\x05AFK Manager\x04]\x01 You cannot use the !idle command while dead."client);
        } 
Darkwob is offline
Send a message via AIM to Darkwob Send a message via Yahoo to Darkwob Send a message via Skype™ to Darkwob
Darkwob
Senior Member
Join Date: Oct 2018
Location: Turkey
Old 05-27-2021 , 20:25   Re: A Author needs to help me. excuse me?
Reply With Quote #2

I still have no solution on this issue.
Darkwob is offline
Send a message via AIM to Darkwob Send a message via Yahoo to Darkwob Send a message via Skype™ to Darkwob
Benito
Member
Join Date: Jul 2018
Location: Belgique - Belgium
Old 05-28-2021 , 08:47   Re: A Author needs to help me. excuse me?
Reply With Quote #3

Hey if it can help you, its putting player on AFK State

Quote:

Handle TimerAFK[MAXPLAYERS + 1] = { null, ... };
ConVar cvar_afk = null;
bool IsAFK[MAXPLAYERS + 1] = false;

public void OnPluginStart()
{
cvar_afk = CreateConVar("afk", "300", "Time to cooldown before to be AFK");
}

public Action OnClientCommand(int client)
{
ResetAFK(client);

return Plugin_Continue;
}

public void OnClientSettingsChanged(int client)
{
ResetAFK(client);
}

public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
if(buttons != 0)
ResetAFK(client);

return Plugin_Continue;
}

int ResetAFK(int client)
{
if(IsClientValid(client))
{
int iYear, iMonth, iDay, iHour, iMinute, iSecond;
UnixToTime(GetTime(), iYear, iMonth, iDay, iHour, iMinute, iSecond, UT_TIMEZONE_CEST);

if(IsAFK[client])
PrintHintText(client, "Re-bonjour <font color='#eaff00'>%N</font>,\n nous sommes le <font color='#0091ff'>%02d/%02d/%d</font>, il est <font color='#0091ff'>%02d:%02d:%02d</font>", client, iDay, iMonth, iYear, iHour, iMinute, iSecond);

rp_SetClientBool(client, b_IsAfk, false);
if(TimerAFK[client] != null)
{
if(CloseHandle(TimerAFK[client]))
TimerAFK[client] = null;
}
TimerAFK[client] = CreateTimer(cvar_afk.FloatValue, SetAFK, client);
}
}

public Action SetAFK(Handle timer, any client)
{
if(IsClientValid(client))
{
if(cvar_afk.FloatValue != 0.0)
IsAFK[client] = true;
}
TimerAFK[client] = null;
}
__________________
Benito is offline
Darkwob
Senior Member
Join Date: Oct 2018
Location: Turkey
Old 05-28-2021 , 09:47   Re: A Author needs to help me. excuse me?
Reply With Quote #4

Quote:
Originally Posted by Benito View Post
Hey if it can help you, its putting player on AFK State
Thank you for the answer but it's a lot of understanding the code, while asking for this help I was actually trying to figure out how to do a countdown timer event.


NOTE: Also, I have a plugin, I don't write a plugin from scratch. My goal is a player when !idle triggers the command, I try to get the plugin player to switch to the spectator team after 15 seconds. ^^


//I wrote this code.
Quote:
CreateTimer(15.0, Idle, _, TIMER_REPEAT);

PrintHintText("[RegionZ] \n After 15 seconds you will be afk.");

Last edited by Darkwob; 05-28-2021 at 09:54.
Darkwob is offline
Send a message via AIM to Darkwob Send a message via Yahoo to Darkwob Send a message via Skype™ to Darkwob
alikoc77
Junior Member
Join Date: Oct 2020
Old 05-31-2021 , 03:37   Re: A Author needs to help me. excuse me?
Reply With Quote #5

Quote:
Originally Posted by Darkwob View Post
Thank you for the answer but it's a lot of understanding the code, while asking for this help I was actually trying to figure out how to do a countdown timer event.


NOTE: Also, I have a plugin, I don't write a plugin from scratch. My goal is a player when !idle triggers the command, I try to get the plugin player to switch to the spectator team after 15 seconds. ^^


//I wrote this code.
Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo = 
{
	name = "",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("sm_idle", Command_Idle);
}
public Action Command_Idle(int client, int args)
{
	if (IsClientInGame(client) && !IsFakeClient(client))
	{
		CreateTimer(15.0, Idle, client);
		PrintHintText(client, "[RegionZ] \n After 15 seconds you will be afk.");
	}
}
public Action Idle(Handle timer, int client)
{
	if (IsClientInGame(client) && !IsFakeClient(client))
	{
		if (GetClientTeam(client) != 1)
		{
			if (IsPlayerAlive(client))
			{
				ChangeClientTeam(client, 1);
				ForcePlayerSuicide(client);
				PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 has moved to Spectator team.", client);
				PrintToServer("\x04[\x05AFK Manager\x04]\x01 Player '%N' has moved to Spectator team.", client);
			}
			else
			{
				PrintToChat(client, "\x04[\x05AFK Manager\x04]\x01 You cannot use the !idle command while dead.", client);
			}
		}        
	}
	return Plugin_Continue;
}
Attached Files
File Type: sp Get Plugin or Get Source (afkk.sp - 9 views - 1.2 KB)
File Type: smx afkk.smx (3.6 KB, 2 views)
alikoc77 is offline
Darkwob
Senior Member
Join Date: Oct 2018
Location: Turkey
Old 05-31-2021 , 13:54   Re: A Author needs to help me. excuse me?
Reply With Quote #6

Quote:
Originally Posted by alikoc77 View Post
Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo = 
{
	name = "",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("sm_idle", Command_Idle);
}
public Action Command_Idle(int client, int args)
{
	if (IsClientInGame(client) && !IsFakeClient(client))
	{
		CreateTimer(15.0, Idle, client);
		PrintHintText(client, "[RegionZ] \n After 15 seconds you will be afk.");
	}
}
public Action Idle(Handle timer, int client)
{
	if (IsClientInGame(client) && !IsFakeClient(client))
	{
		if (GetClientTeam(client) != 1)
		{
			if (IsPlayerAlive(client))
			{
				ChangeClientTeam(client, 1);
				ForcePlayerSuicide(client);
				PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 has moved to Spectator team.", client);
				PrintToServer("\x04[\x05AFK Manager\x04]\x01 Player '%N' has moved to Spectator team.", client);
			}
			else
			{
				PrintToChat(client, "\x04[\x05AFK Manager\x04]\x01 You cannot use the !idle command while dead.", client);
			}
		}        
	}
	return Plugin_Continue;
}
not work bro. I already have an afk plugin. I'm sending it to you privately and throwing the error I got.
Darkwob is offline
Send a message via AIM to Darkwob Send a message via Yahoo to Darkwob Send a message via Skype™ to Darkwob
alikoc77
Junior Member
Join Date: Oct 2020
Old 05-31-2021 , 16:35   Re: A Author needs to help me. excuse me?
Reply With Quote #7

Quote:
Originally Posted by Darkwob View Post
not work bro. I already have an afk plugin. I'm sending it to you privately and throwing the error I got.
tamamdır bekliyorum

Last edited by alikoc77; 05-31-2021 at 16:36.
alikoc77 is offline
Darkwob
Senior Member
Join Date: Oct 2018
Location: Turkey
Old 06-03-2021 , 22:28   Re: A Author needs to help me. excuse me?
Reply With Quote #8

Quote:
Originally Posted by alikoc77 View Post
tamamdır bekliyorum
hocam size yazdım ama cevap alamadım.
Darkwob is offline
Send a message via AIM to Darkwob Send a message via Yahoo to Darkwob Send a message via Skype™ to Darkwob
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 06-07-2021 , 11:31   Re: A Author needs to help me. excuse me?
Reply With Quote #9

Quote:
Originally Posted by Darkwob View Post
I was actually trying to figure out how to do a countdown timer event.
Try this code:
PHP Code:
#pragma semicolon 1
#pragma newdecls required

static const int
    TIMEOUT            
15;
static const 
char
    PREFIX_HINT
[]    = "[RegionZ]",
    
PREFIX_CHAT[]    = "\x04[\x05AFK Manager\x04] \x01",
    
PREFIX_CON[]    = "[AFK Manager] ";

Handle
    hTimer
[MAXPLAYERS+1];
int
    iTime
[MAXPLAYERS+1];

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_idle"Cmd_Idle);
}

public 
void OnMapEnd()
{
    for(
int i 1<= MaxClientsi++) OnClientDisconnect(i);
}

public 
void OnClientDisconnect(int client)
{
    if(
hTimer[client]) delete hTimer[client];
}

public 
Action Cmd_Idle(int clientint args)
{
    if(!
client || IsFakeClient(client) || GetClientTeam(client) < 2)
        return 
Plugin_Handled;

    if(!
IsPlayerAlive(client))
    {
        
PrintToChat(client"%sYou cannot use the \x04!idle \x01command while dead."PREFIX_CHATclient);
        return 
Plugin_Handled;
    }

    if(!
hTimer[client])
    {
        
iTime[client] = GetTime() + TIMEOUT;
        
hTimer[client] = CreateTimer(1.0Timer_IdleGetClientUserId(client), TIMER_REPEAT);
        
PrintHintText(client"%s\n After %i seconds you will be afk."PREFIX_HINTTIMEOUT);
    }
    else 
PrintToChat(client"%sBe patient, you have already used the \x04!idle \x01command."PREFIX_CHATclient);

    return 
Plugin_Handled;
}

public 
Action Timer_Idle(Handle timerint uid)
{
    
int client GetClientUserId(uid);
    if(!
client || GetClientTeam(client) < 2)
    {
        
hTimer[client] = null;
        return 
Plugin_Stop;
    }

    
int time iTime[client] - GetTime();
    if(
time 0)
    {
        
PrintHintText(client"%s\nAfter %i seconds you will be afk."PREFIX_CHATtime);
        return 
Plugin_Continue;
    }

    
ChangeClientTeam(client1);
    
PrintToChatAll("%sPlayer \x04%N\x01 has moved to Spectator team."PREFIX_CHATclient);
    
PrintToServer("%sPlayer '%N' has moved to Spectator team."PREFIX_CONclient);
    
hTimer[client] = null;
    return 
Plugin_Stop;

__________________
Grey83 is offline
Darkwob
Senior Member
Join Date: Oct 2018
Location: Turkey
Old 06-07-2021 , 12:21   Re: A Author needs to help me. excuse me?
Reply With Quote #10

Quote:
Originally Posted by Grey83 View Post
Try this code:
PHP Code:
#pragma semicolon 1
#pragma newdecls required

static const int
    TIMEOUT            
15;
static const 
char
    PREFIX_HINT
[]    = "[RegionZ]",
    
PREFIX_CHAT[]    = "\x04[\x05AFK Manager\x04] \x01",
    
PREFIX_CON[]    = "[AFK Manager] ";

Handle
    hTimer
[MAXPLAYERS+1];
int
    iTime
[MAXPLAYERS+1];

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_idle"Cmd_Idle);
}

public 
void OnMapEnd()
{
    for(
int i 1<= MaxClientsi++) OnClientDisconnect(i);
}

public 
void OnClientDisconnect(int client)
{
    if(
hTimer[client]) delete hTimer[client];
}

public 
Action Cmd_Idle(int clientint args)
{
    if(!
client || IsFakeClient(client) || GetClientTeam(client) < 2)
        return 
Plugin_Handled;

    if(!
IsPlayerAlive(client))
    {
        
PrintToChat(client"%sYou cannot use the \x04!idle \x01command while dead."PREFIX_CHATclient);
        return 
Plugin_Handled;
    }

    if(!
hTimer[client])
    {
        
iTime[client] = GetTime() + TIMEOUT;
        
hTimer[client] = CreateTimer(1.0Timer_IdleGetClientUserId(client), TIMER_REPEAT);
        
PrintHintText(client"%s\n After %i seconds you will be afk."PREFIX_HINTTIMEOUT);
    }
    else 
PrintToChat(client"%sBe patient, you have already used the \x04!idle \x01command."PREFIX_CHATclient);

    return 
Plugin_Handled;
}

public 
Action Timer_Idle(Handle timerint uid)
{
    
int client GetClientUserId(uid);
    if(!
client || GetClientTeam(client) < 2)
    {
        
hTimer[client] = null;
        return 
Plugin_Stop;
    }

    
int time iTime[client] - GetTime();
    if(
time 0)
    {
        
PrintHintText(client"%s\nAfter %i seconds you will be afk."PREFIX_CHATtime);
        return 
Plugin_Continue;
    }

    
ChangeClientTeam(client1);
    
PrintToChatAll("%sPlayer \x04%N\x01 has moved to Spectator team."PREFIX_CHATclient);
    
PrintToServer("%sPlayer '%N' has moved to Spectator team."PREFIX_CONclient);
    
hTimer[client] = null;
    return 
Plugin_Stop;

thanks for answer but not work ı give you source code bro

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.4"

public Plugin myinfo =  {
    
name "[L4D] AFK Manager"
    
author "DarkWob"
    
description ""
    
version PLUGIN_VERSION
    
url "http://www.regionz.ml"
};

float advertiseInterval 300.0;
Handle advertiseTimer null;

float specTime[MAXPLAYERS 1];
float afkTime[MAXPLAYERS 1];

float checkInterval 10.0;
float maxAfkSpecTime 40.0;
float maxAfkKickTime 480.0;
float joinTeamInterval 60.0;
float timeLeftInterval 5.0;

float lastMessage[MAXPLAYERS 1];

float clientPos[MAXPLAYERS 1][3];
float clientAngles[MAXPLAYERS 1][3];

int messageLevel 3;
int iTimeAfk;

public 
void OnPluginStart()
{
    
CreateConVar("l4d_afkmanager_version"PLUGIN_VERSION"[L4D(2)] AFK Manager"FCVAR_SPONLY FCVAR_NOTIFY FCVAR_DONTRECORD);
    
SetConVarString(FindConVar("l4d_afkmanager_version"), PLUGIN_VERSION);
    
    
char temp[12];
    
    
FloatToString(advertiseIntervaltempsizeof(temp)); (CreateConVar("afk_adinterval"temp"Interval in which the plugin will advertise the 'idle' command.")).AddChangeHook(convar_AdvertiseTime);
    
FloatToString(maxAfkSpecTimetempsizeof(temp)); (CreateConVar("afk_spectime"temp"AFK time after which you will be moved to the Spectator team.")).AddChangeHook(convar_AfkSpecTime);
    
FloatToString(maxAfkKickTimetempsizeof(temp)); (CreateConVar("afk_kicktime"temp"AFK time after which you will be kicked.")).AddChangeHook(convar_AfkKickTime);
    (
CreateConVar("afk_messages""3""Control spec/kick messages. (0 = disable, 1 = spec, 2 = kick, 3 = spec + kick")).AddChangeHook(convar_Messages);
    
FloatToString(joinTeamIntervaltempsizeof(temp)); (CreateConVar("afk_joinmsg_time"temp)).AddChangeHook(convar_JoinMsgTime);
    
FloatToString(timeLeftIntervaltempsizeof(temp)); (CreateConVar("afk_warning_time"temp)).AddChangeHook(convar_WarningTime);
    
    
HookEvent("player_team"Event_PlayerTeam);
    
HookEvent("round_end"Event_RoundEndEventHookMode_PostNoCopy);
    
    
CreateTimer(1.0MapStart);
    
advertiseTimer CreateTimer(advertiseIntervaltimer_Advertise_TIMER_REPEAT);
    
CreateTimer(checkIntervaltimer_Check_TIMER_REPEAT);
    
    
//AutoExecConfig(true, "l4d_afkmanager");
    
    // Register Console Commands
    
RegConsoleCmd("sm_idle"Idle"Switches yourself to spectate mode if you are alive");
    
RegConsoleCmd("sm_afk"Idle"Switches yourself to spectate mode if you are alive");
}

public 
Action MapStart(Handle timer)
{
    
OnMapStart();
}

public 
void OnMapStart()
{
    
iTimeAfk GetTime();
}

public 
void convar_JoinMsgTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
joinTeamInterval StringToFloat(newValue);
}

public 
void convar_WarningTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
timeLeftInterval StringToFloat(newValue);
}

public 
void convar_Messages(ConVar convar, const char[] oldValue, const char[] newValue)
{
    if (
messageLevel <= 0)
    {
        
convar.SetInt(0);
        return;
    }
    if (
messageLevel >= 3)
    {
        
convar.SetInt(3);
        return;
    }
    
messageLevel convar.IntValue;
}

public 
Action timer_Check(Handle timer)
{
    
float currentPos[3];
    
float currentAngles[3];
    
    
int team;
    
bool isAFK;
    
int clientindex;
    
    for (
client 1client <= MaxClientsclient++)
    {
        if (
IsClientInGame(client) && !IsFakeClient(client))
        {
            
team GetClientTeam(client);
            if (
team == 1)
            {
                
specTime[client] += checkInterval;
                if (
specTime[client] >= maxAfkKickTime)
                {
                    
                    if (
GetRealClientCount() > 25)
                    {
                        
                        if (!
IsVip(client))
                        {
                            
KickClient(client"You were AFK for too long.");
                            if (
messageLevel >= 2)
                                
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 was kicked."client);
                        }
                    }
                    
                    if (
GetClientCount(false) >= 30 && !IsRoot(client))
                    {
                        
KickClient(client"You were AFK for too long.");
                        if (
messageLevel >= 2)
                            
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 was kicked."client);
                    }
                    else
                        
specTime[client] = (specTime[client] - checkInterval 1);
                }
                else
                {
                    if (
GetClientTime(client) - lastMessage[client] >= timeLeftInterval)
                    {
                        if (!
IsRoot(client))
                            
PrintToChat(client"\x04[\x05AFK Manager\x04]\x01 You can spectate for \x04%d\x01 more seconds before you will be kicked."RoundToFloor(maxAfkKickTime specTime[client]));
                        
lastMessage[client] = GetClientTime(client);
                    }
                    if (
GetClientTime(client) - lastMessage[client] >= joinTeamInterval)
                    {
                        if (!
IsRoot(client))
                            
PrintToChat(client"\x04[\x05AFK Manager\x04]\x01 Say \x05!join\x01 to join game.");
                        
lastMessage[client] = GetClientTime(client);
                    }
                }
            }
            else if (
IsPlayerAlive(client) && (team == || team == 3))
            {
                
GetClientAbsOrigin(clientcurrentPos);
                
GetClientAbsAngles(clientcurrentAngles);
                
                
isAFK true;
                for (
index 0index 3index++)
                {
                    if (
currentPos[index] != clientPos[client][index])
                    {
                        
isAFK false;
                        break;
                    }
                }
                if (
isAFK)
                {
                    for (
index 0index 3index++)
                    {
                        if (
currentAngles[index] != clientAngles[client][index])
                        {
                            
isAFK false;
                            break;
                        }
                    }
                }
                if (
isAFK)
                {
                    
afkTime[client] += checkInterval;
                    if (
afkTime[client] >= maxAfkSpecTime)
                    {
                        if (
GetClientCount(false) >= 30)
                        {
                            
KickClient(client"Sorry, no open slots for spectators.");
                            if (
messageLevel >= 2)
                                
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 was kicked. No open slots for spectators."client);
                        }
                        else
                            
ClientAFK(client);
                    }
                }
                else
                    
afkTime[client] = 0.0;
                
                for (
index 0index 3index++)
                {
                    
clientPos[client][index] = currentPos[index];
                    
clientAngles[client][index] = currentAngles[index];
                }
            }
        }
    }
    return 
Plugin_Continue;
}

void ClientAFK(int client)
{
    if (!
IsClientInGame(client))
        return;
    if (
IsFakeClient(client))
        return;
    if (
GetClientTeam(client) == 1)
        return;
    
    
float fAFK GetRandomFloat(0.15.1);
    
CreateTimer(fAFKTimer_Afkclient);
}

public 
Action Timer_Afk(Handle timerany client)
{
    if (
IsClientInGame(client))
    {
        if (!
IsFakeClient(client))
        {
            if (
GetClientTeam(client) != 1)
            {
                
int afktime = (GetTime() - iTimeAfk);
                if (
afktime 50)
                    
afkTime[client] = (afkTime[client] - (checkInterval 1.0));
                else
                {
                    if (
GetClientCount(false) >= 30)
                    {
                        
KickClient(client"Sorry, no open slots for spectators.");
                        if (
messageLevel >= 2)
                            
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 was kicked. No open slots for spectators."client);
                        return 
Plugin_Stop;
                    }
                    
                    if (
messageLevel == || messageLevel == 3)
                        
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 was moved to Spectator team."client);
                    
PrintToServer("[AFK Manager] Player '%N' was moved to Spectator team."client);
                    
//ServerCommand("sm_switchplayer2 #%d 1", GetClientUserId(client));
                    
ChangeClientTeam(client1);
                    
ForcePlayerSuicide(client);
                    
iTimeAfk GetTime();
                }
            }
        }
    }
    return 
Plugin_Stop;
}

int GetRealClientCount()
{
    
int clients 0;
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            if (!
IsFakeClient(i))
                
clients++;
        }
    }
    return 
clients;
}

public 
void convar_AfkSpecTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
maxAfkSpecTime StringToFloat(newValue);
    if (
maxAfkSpecTime == 0.0 || maxAfkSpecTime <= 30.0)
    {
        
convar.SetFloat(30.0);
        return;
    }
}

public 
void convar_AfkKickTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
    
maxAfkKickTime StringToFloat(newValue);
    if (
maxAfkKickTime == 0.0 || maxAfkKickTime <= 60.0)
    {
        
convar.SetFloat(60.0);
        return;
    }
}

public 
Action Event_PlayerTeam(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
int team GetEventInt(event"team");
    switch (
team)
    {
        case 
1:specTime[client] = 0.0;
        case 
23:afkTime[client] = 0.0;
    }
    if (
event.GetBool("disconnected"))
    {
        
clientPos[client] = view_as<float>( { 0.00.00.0 } );
        
clientAngles[client] = view_as<float>( { 0.00.00.0 } );
    }
}

public 
void convar_AdvertiseTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
    if (
advertiseTimer != null)
    {
        
KillTimer(advertiseTimer);
        
advertiseTimer null;
    }
    
advertiseInterval StringToFloat(newValue);
    if (
advertiseInterval <= 10.0)
    {
        
convar.SetFloat(10.0);
        return;
    }
    if (
advertiseInterval 0.0)
        
advertiseTimer CreateTimer(advertiseIntervaltimer_Advertise_TIMER_REPEAT);
}

public 
Action Idle(int clientint args)
{
    
    if (
IsClientInGame(client) && !IsFakeClient(client))
    {
        
CreateTimer(15.0Idleclient);
        
PrintHintText(client"[RegionZ] \n After 15 seconds you will be afk.");
    }
    
    if (
GetClientTeam(client) != 1)
    {
        if (
IsPlayerAlive(client))
        {
            
ChangeClientTeam(client1);
            
ForcePlayerSuicide(client);
            
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Player \x04'%N'\x01 has moved to Spectator team."client);
            
PrintToServer("\x04[\x05AFK Manager\x04]\x01 Player '%N' has moved to Spectator team."client);
        }
        else
        {
            
PrintToChat(client"\x04[\x05AFK Manager\x04]\x01 You cannot use the !idle command while dead."client);
        }
    }
}

public 
Action timer_Advertise(Handle timer)
{
    
PrintToChatAll("\x04[\x05AFK Manager\x04]\x01 Use \x05!idle \x01if you plan to go AFK for a while.");
    return 
Plugin_Continue;
}

bool IsRoot(int client)
{
    
AdminId admin GetUserAdmin(client);
    
    if (
admin == INVALID_ADMIN_ID)
        return 
false;
    if (
GetAdminFlag(adminAdmin_Root) || GetAdminFlag(adminAdmin_Password))
        return 
true;
    
    return 
true;
}

bool IsVip(int client)
{
    
AdminId admin GetUserAdmin(client);
    
    if (
admin == INVALID_ADMIN_ID)
        return 
false;
    if (
GetAdminFlag(adminAdmin_Reservation))
        return 
true;
    return 
true;
}

public 
Action Event_RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    
int i 1;
    while (
<= MaxClients)
    {
        if (
IsClientInGame(i))
        {
            
afkTime[i] = 0.0;
        }
        
+= 1;
    }

Also, I would appreciate if you could check it by sending a PM to you.��
__________________
HTML Code:
<a href="https://www.gametracker.com/server_info/157.90.180.232:27215/" target="_blank"><img src="https://cache.gametracker.com/server_info/157.90.180.232:27215/b_560_95_1.png" border="0" width="560" height="95" alt=""/></a>

Last edited by Darkwob; 06-07-2021 at 13:23.
Darkwob is offline
Send a message via AIM to Darkwob Send a message via Yahoo to Darkwob Send a message via Skype™ to Darkwob
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:46.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode