StuckRequest: get rid of obselete bool and clean handle
This commit is contained in:
parent
1f3e7c8559
commit
05321cbc8d
@ -8,7 +8,6 @@
|
|||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
|
|
||||||
bool g_bStuckRequestAuto;
|
bool g_bStuckRequestAuto;
|
||||||
bool g_bStuckRequest;
|
|
||||||
|
|
||||||
int g_iStuckRequester;
|
int g_iStuckRequester;
|
||||||
|
|
||||||
@ -43,7 +42,7 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
AutoExecConfig(true, "plugin.StuckRequest");
|
AutoExecConfig(true, "plugin.StuckRequest");
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void g_cvStuckRequestAuto(ConVar convar, const char[] oldValue, const char[] newValue)
|
public void g_cvStuckRequestAuto(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||||
@ -72,9 +71,9 @@ public Action OnPlayerDeath(Event event, const char[] name, bool dontBroadcast)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
KillTimer(StuckRequestTimer);
|
KillTimer(StuckRequestTimer);
|
||||||
|
StuckRequestTimer = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,9 +89,9 @@ public void OnClientDisconnect(int client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
KillTimer(StuckRequestTimer);
|
KillTimer(StuckRequestTimer);
|
||||||
|
StuckRequestTimer = INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Action Command_StuckRequest(int client, int args)
|
public Action Command_StuckRequest(int client, int args)
|
||||||
@ -115,7 +114,7 @@ public Action Command_StuckRequest(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_bStuckRequest)
|
if(g_iStuckRequester != 0)
|
||||||
{
|
{
|
||||||
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} Another Request is pending! Try again in couple seconds.");
|
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} Another Request is pending! Try again in couple seconds.");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -141,7 +140,6 @@ public Action Command_StuckRequest(int client, int args)
|
|||||||
|
|
||||||
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} Sent your Request to Admins!");
|
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} Sent your Request to Admins!");
|
||||||
g_iStuckRequester = client;
|
g_iStuckRequester = client;
|
||||||
g_bStuckRequest = true;
|
|
||||||
SendRequestToAdmin(g_iStuckRequester);
|
SendRequestToAdmin(g_iStuckRequester);
|
||||||
StuckRequestTimer = CreateTimer(g_fStuckRequestTimer, OnStuckRequest);
|
StuckRequestTimer = CreateTimer(g_fStuckRequestTimer, OnStuckRequest);
|
||||||
|
|
||||||
@ -155,7 +153,7 @@ public Action OnStuckRequest(Handle timer)
|
|||||||
if(ZR_IsClientZombie(g_iStuckRequester))
|
if(ZR_IsClientZombie(g_iStuckRequester))
|
||||||
ZR_HumanClient(g_iStuckRequester, false, false);
|
ZR_HumanClient(g_iStuckRequester, false, false);
|
||||||
|
|
||||||
int iRandomHuman = -1;
|
int iRandomHuman = 0;
|
||||||
int PotentialTPCount;
|
int PotentialTPCount;
|
||||||
int PotentialTPClient[64];
|
int PotentialTPClient[64];
|
||||||
|
|
||||||
@ -172,8 +170,7 @@ public Action OnStuckRequest(Handle timer)
|
|||||||
{
|
{
|
||||||
CPrintToChat(g_iStuckRequester, "{lightgreen}[StuckRequest]{yellow} Round ended while the Request was pending! Request aborted.");
|
CPrintToChat(g_iStuckRequester, "{lightgreen}[StuckRequest]{yellow} Round ended while the Request was pending! Request aborted.");
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
|
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
@ -216,8 +213,7 @@ public Action OnStuckRequest(Handle timer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -237,7 +233,7 @@ public Action SendRequestToAdmin(int client)
|
|||||||
|
|
||||||
public Action Command_AcceptRequest(int client, int args)
|
public Action Command_AcceptRequest(int client, int args)
|
||||||
{
|
{
|
||||||
if(!g_bStuckRequest)
|
if(g_iStuckRequester == 0)
|
||||||
{
|
{
|
||||||
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} There is no Request pending!");
|
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} There is no Request pending!");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -246,7 +242,7 @@ public Action Command_AcceptRequest(int client, int args)
|
|||||||
if(ZR_IsClientZombie(g_iStuckRequester))
|
if(ZR_IsClientZombie(g_iStuckRequester))
|
||||||
ZR_HumanClient(g_iStuckRequester, false, false);
|
ZR_HumanClient(g_iStuckRequester, false, false);
|
||||||
|
|
||||||
int iRandomHuman = -1;
|
int iRandomHuman = 0;
|
||||||
int PotentialTPCount;
|
int PotentialTPCount;
|
||||||
int PotentialTPClient[64];
|
int PotentialTPClient[64];
|
||||||
|
|
||||||
@ -263,9 +259,9 @@ public Action Command_AcceptRequest(int client, int args)
|
|||||||
{
|
{
|
||||||
CPrintToChat(g_iStuckRequester, "{lightgreen}[StuckRequest]{yellow} Round ended while the Request was pending! Request aborted.");
|
CPrintToChat(g_iStuckRequester, "{lightgreen}[StuckRequest]{yellow} Round ended while the Request was pending! Request aborted.");
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
KillTimer(StuckRequestTimer);
|
KillTimer(StuckRequestTimer);
|
||||||
|
StuckRequestTimer = INVALID_HANDLE;
|
||||||
|
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
@ -295,16 +291,16 @@ public Action Command_AcceptRequest(int client, int args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
KillTimer(StuckRequestTimer);
|
KillTimer(StuckRequestTimer);
|
||||||
|
StuckRequestTimer = INVALID_HANDLE;
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Command_DenyRequest(int client, int args)
|
public Action Command_DenyRequest(int client, int args)
|
||||||
{
|
{
|
||||||
if(!g_bStuckRequest)
|
if(g_iStuckRequester == 0)
|
||||||
{
|
{
|
||||||
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} There is no Request pending!");
|
CReplyToCommand(client, "{lightgreen}[StuckRequest]{yellow} There is no Request pending!");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
@ -320,9 +316,9 @@ public Action Command_DenyRequest(int client, int args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_iStuckRequester = -1;
|
g_iStuckRequester = 0;
|
||||||
g_bStuckRequest = false;
|
|
||||||
KillTimer(StuckRequestTimer);
|
KillTimer(StuckRequestTimer);
|
||||||
|
StuckRequestTimer = INVALID_HANDLE;
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user