Senior Member
|
04-29-2019
, 15:27
error 001: expected token: "]", but found "-integer value-"
|
#1
|
I can't fix this minor problem for 2 days....
Compiler error log
Code:
D:\csgo-materials\자작 플긴\csgo-warmod\pug-a1.sp(413) : error 001: expected token: "]", but found "-integer value-"
D:\csgo-materials\자작 플긴\csgo-warmod\pug-a1.sp(413) : warning 215: expression has no effect
D:\csgo-materials\자작 플긴\csgo-warmod\pug-a1.sp(413) : error 001: expected token: ";", but found "]"
D:\csgo-materials\자작 플긴\csgo-warmod\pug-a1.sp(413) : error 029: invalid expression, assumed zero
D:\csgo-materials\자작 플긴\csgo-warmod\pug-a1.sp(413) : fatal error 190: too many error messages on one line
Full Code
PHP Code:
#define PL_NAME "csgo pug"
#define PL_AUTHOR "lck"
#define PL_DESCRIPTION "csgo simple pug plugin"
#define PL_VERSION "alpha 1.0"
#define PL_URL "https://steamcommunity.com/profiles/76561198149066707"
public Plugin:myinfo = {
name = PL_NAME,
description = PL_AUTHOR,
description = PL_DESCRIPTION,
description = PL_VERSION,
description = PL_URL
};
// Main Frame
#include <sourcemod>
#include <cstrike>
// DEBUG MODE
bool g_bDebug = false;
Handle g_hDebugAlertHud = INVALID_HANDLE,
g_hDebugHud = INVALID_HANDLE;
// enum Game State Type
enum GameState {
GS_DUMMY = -1,
GS_WARMUP = 0,
GS_CAP = 1,
GS_PRIORITY = 2,
GS_PICK = 3,
GS_MAP = 4,
GS_KNIFE = 5,
GS_ATDF = 6,
GS_READY = 7,
GS_INGAME = 8,
GS_BREAKINGAME = 9,
GS_OVERTIME = 10,
GS_GAMEEND = 11
};
// enum Debug Output Type
enum DebugOutput {
DEBUG_CHAT = 1,
DEBUG_ALLCHAT = 2,
DEBUG_HUD = 4,
DEBUG_HUDALL = 8,
DEBUG_LOG = 16
};
GameState g_cGSCurrentState = GS_WARMUP;
ConVar g_cVTagEnablity,
g_cVTagCap,
g_cVTagPlayer,
g_cVTagSpectator;
// Cap Section
ConVar g_cVCapRestrictTimerVal,
g_cVCapRestrictTimerEnablity,
g_cVCapUserMessageEnablity,
g_cVCapUserMessageTimerVal,
g_cVCapRandomIgnoreOringal,
g_cVCapElectMethod;
int g_AiCapList[2] = {0, 0};
int g_iCapForceTemp = 0;
float g_flCapRestrictTimer = 0.0,
g_flCapUserMessageTimer = 0.0;
public OnPluginStart() {
g_hDebugAlertHud = CreateHudSynchronizer();
g_hDebugHud = CreateHudSynchronizer();
if(GetEngineVersion() != Engine_CSGO) SetFailState("THIS PLUGIN IS DESIGNED FOR CSGO.");
LoadTranslations("common.phrases");
RegAdminCmd("sm_c0", o_CBCapVolunteer, 0);
RegAdminCmd("sm_cf0", o_CBCapForceManage, ADMFLAG_ROOT);
RegAdminCmd("sm_debug", o_CBDebugMode, ADMFLAG_ROOT);
AddCommandListener(o_CBJoinTeam, "jointeam");
ResetVariables(true, GS_DUMMY);
CreateConVars();
HookConVarChanges();
UpdateVariables();
}
public OnGameFrame() {
// Debugging
if(g_bDebug) PrintDebugMsg();
// Game State
if(g_cGSCurrentState == GS_WARMUP) {
if(GetInGamePlayers() == 10) ShiftGameStateForward();
}
if(g_cGSCurrentState == GS_CAP) {
if(GetInGamePlayers() < 10) {
ShiftGameStateBackward();
return;
}
if(IsCapFull(CS_TEAM_CT) && IsCapFull(CS_TEAM_T)) {
ShiftGameStateForward();
return;
}
if(g_flCapRestrictTimer <= GetGameTime()) {
SelectRandomCap();
return;
}
if(g_flCapUserMessageTimer <= GetGameTime() && g_cVCapUserMessageEnablity.BoolValue) {
g_flCapUserMessageTimer = GetGameTime() + g_cVCapUserMessageTimerVal.FloatValue;
// Messaging
if(g_cVCapElectMethod.IntValue == 0) PrintToChatAll(" >> Call Admin for Election of Cap.");
if(g_cVCapElectMethod.IntValue == 1) PrintToChatAll(" >> Players who want to be a caps, please Type !c0 for election of Cap.");
return;
}
}
}
public OnClientSettingsChanged(client) {
if(!IsValidClient(client)) return;
UpdatePlayerSettings(client);
}
public OnConfigsExecuted() {
UpdateVariables();
}
public o_CBcVChange(ConVar cvar, const char[] oldValue, const char[] newValue) {
UpdateVariables();
}
public Action o_CBJoinTeam(client, const String:command[], argc) {
if(!IsValidClient(client) || argc < 1)
return Plugin_Handled;
new String:arg[10];
GetCmdArg(1, arg, sizeof(arg));
new TargetTeam = StringToInt(arg);
if(g_cGSCurrentState == GS_CAP) {
if(TargetTeam != CS_TEAM_SPECTATOR) {
ReplyToCommand(client, " >> Joining team during match is not allowed.\nJoin Spectator, Please.");
return Plugin_Handled;
}
}
if(TargetTeam < 0 || TargetTeam > CS_TEAM_CT) {
ReplyToCommand(client, " >> Joining that team is not allowed.");
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action o_CBCapVolunteer(client, args) {
// Ignore The Command
if(!IsValidClient(client)) return Plugin_Handled;
if(IsSpectator(client)) return Plugin_Handled;
if(g_cVCapElectMethod.IntValue != 1) return Plugin_Handled;
// Reply Denial The Commmand
if(IsCapFull(CS_TEAM_CT) && IsCapFull(CS_TEAM_T)) {
ReplyToCommand(client, " >> Captain slots are all reserved.");
return Plugin_Handled;
}
if(IsPlayerCap(client)) {
ReplyToCommand(client, " >> You are already a captain.");
return Plugin_Handled;
}
new EmptyCapSlot = GetEmptyCapSlot();
g_AiCapList[EmptyCapSlot] = client;
UpdatePlayerSettings(client);
PrintToChat(client, " >> You are now a Captain.");
PrintToChatAll(" >> %N is now a Captain.", client);
return Plugin_Continue;
}
public Action o_CBCapForceManage(client, args) {
if(!IsValidClient(client)) return Plugin_Handled;
new Handle:menu = CreateMenu(o_CBMenuPlayerList);
SetMenuTitle(menu, "Please Select A Player for Cap.");
new AvaliablePlayers = 0;
for(new i=1; i<=MaxClients; i++) {
if(IsValidClient(i)) if(!IsSpectator(i)) if(!IsPlayerCap(i)) {
new String:ii[3], String:name[MAX_NAME_LENGTH];
IntToString(i, ii, 3);
GetClientName(i, name, sizeof(name));
AddMenuItem(menu, ii, name);
AvaliablePlayers++
}
}
SetMenuExitButton(menu, true);
if(AvaliablePlayers > 0) DisplayMenu(menu, client, 0);
else CloseHandle(menu);
return Plugin_Continue;
}
public int o_CBMenuPlayerList(Handle menu, MenuAction action, int client, int pos) {
if(action == MenuAction_Select) {
// Save the Value on Temporary Global Variable
new String:item[3];
GetMenuItem(menu, pos, item, 3);
// @ GS_CAP
g_iCapForceTemp = StringToInt(item);
// Create a Team Select Menu @ GS_CAP
new Handle:menu2 = CreateMenu(o_CBMenuTeamList);
SetMenuTitle(menu2, "Please Select A Team for Cap.");
AddMenuItem(menu2, "0", "T");
AddMenuItem(menu2, "1", "CT");
SetMenuExitButton(menu2, true);
DisplayMenu(menu2, client, 0);
// Debug
DebugForceCapMenu("o_CBMenuPlayerList CB", menu, action, client, pos);
} else if(action == MenuAction_Cancel) {
// Debug
DebugForceCapMenu("o_CBMenuPlayerList CB", menu, action, client, pos);
CloseHandle(menu);
g_iCapForceTemp = 0;
}
}
public int o_CBMenuTeamList(Handle menu, MenuAction action, int client, int pos) {
if(action == MenuAction_Select) {
// Save the Value on Temporary Global Variable
new String:item[2];
GetMenuItem(menu, pos, item, 2);
// @ GS_CAP
new team = StringToInt(item);
g_AiCapList[team] = g_iCapForceTemp;
UpdatePlayerSettings(g_AiCapList[team]);
g_iCapForceTemp = 0;
PrintToChatAll(" >> %N has been forced to be a Captain.", g_iCapForceTemp);
// Debug
DebugForceCapMenu("o_CBMenuTeamList CB", menu, action, client, pos);
} else if(action == MenuAction_Cancel) {
// Debug
DebugForceCapMenu("o_CBMenuTeamList CB", menu, action, client, pos);
CloseHandle(menu);
g_iCapForceTemp = 0;
}
}
void DebugForceCapMenu(char[] m_sDebugName, Handle m_hmenu, MenuAction m_cMAaction, int m_iclient, int m_ipos) {
char p_sDebugMsg[11][100];
Format(p_sDebugMsg[0], sizeof(p_sDebugMsg[0]), "< p_Variable Section >");
Format(p_sDebugMsg[1], sizeof(p_sDebugMsg[1]), "Handle:menu %x", m_hmenu);
Format(p_sDebugMsg[2], sizeof(p_sDebugMsg[2]), "MenuAction:action %d", view_as<int>(m_cMAaction));
if(IsValidClient(client)) Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "client %d => %N", m_iclient, m_iclient);
else Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "Client Invalid");
Format(p_sDebugMsg[4], sizeof(p_sDebugMsg[4]), "pos %d", m_ipos);
Format(p_sDebugMsg[5], sizeof(p_sDebugMsg[5]), "< g_Variable Section >");
Format(p_sDebugMsg[6], sizeof(p_sDebugMsg[6]), "g_cGSCurrentState %d", view_as<int>(g_cGSCurrentState));
Format(p_sDebugMsg[7], sizeof(p_sDebugMsg[7]), "g_AiCapList %d %d", g_AiCapList[0], g_AiCapList[1]);
Format(p_sDebugMsg[8], sizeof(p_sDebugMsg[8]), "g_iCapForceTemp %d", g_iCapForceTemp);
Format(p_sDebugMsg[9], sizeof(p_sDebugMsg[9]), "g_flCapRestrictTimer %2f", g_flCapRestrictTimer);
Format(p_sDebugMsg[10], sizeof(p_sDebugMsg[10]), "g_flCapUserMessageTimer %2f", g_flCapUserMessageTimer);
PrintDebugAlert(m_sDebugName, m_sDebugMsg, 11, DEBUG_ALLCHAT);
}
public Action o_CBDebugMode(client, args) {
g_bDebug = !g_bDebug;
if(g_bDebug) PrintToChat(client, " >> Debug Mode is now true.");
else PrintToChat(client, " >> Debug Mode is now false.");
return Plugin_Continue;
}
void UpdateVariables() {
if(g_cVCapRestrictTimerVal.FloatValue < 0.0) g_cVCapRestrictTimerVal.FloatValue = 0.0;
if(g_cVTagEnablity.IntValue > 2) g_cVCapRestrictTimerVal.IntValue = 2;
if(g_cVTagEnablity.IntValue < 0) g_cVCapRestrictTimerVal.IntValue = 0;
if(g_cVCapElectMethod.IntValue > 2) g_cVCapElectMethod.IntValue = 2;
if(g_cVCapElectMethod.IntValue < 0) g_cVCapElectMethod.IntValue = 0;
if(g_cVCapRestrictTimerEnablity.IntValue > 1) g_cVCapRestrictTimerEnablity.IntValue = 1; // bool
if(g_cVCapRestrictTimerEnablity.IntValue < 0) g_cVCapRestrictTimerEnablity.IntValue = 0;
if(g_cVCapRandomIgnoreOringal.IntValue > 1) g_cVCapRandomIgnoreOringal.IntValue = 1; // bool
if(g_cVCapRandomIgnoreOringal.IntValue < 0) g_cVCapRandomIgnoreOringal.IntValue = 0;
if(g_cVCapUserMessageEnablity.IntValue > 1) g_cVCapUserMessageEnablity.IntValue = 1; // bool
if(g_cVCapUserMessageEnablity.IntValue < 0) g_cVCapUserMessageEnablity.IntValue = 0;
if(g_cVCapUserMessageTimerVal.FloatValue < 0.0) g_cVCapUserMessageTimerVal.FloatValue = 0.0;
for(int i=1; i<=MaxClients; i++) if(IsValidClient(i)) UpdatePlayerSettings(i);
if(!g_cVCapRestrictTimerEnablity.BoolValue) if(g_flCapRestrictTimer > GetGameTime()) g_flCapRestrictTimer = 0.0;
if(!g_cVCapUserMessageEnablity.BoolValue) if(g_flCapUserMessageTimer > GetGameTime()) g_flCapUserMessageTimer = 0.0;
}
void ResetVariables(bool m_bresetall = false, GameState m_cGSstartstate == GS_DUMMY) {
bool p_bResetAllVar = (m_cGSstartstate == GS_DUMMY && m_bresetall);
if(m_cGSstartstate == GS_DUMMY || p_bResetAllVar) {
g_bDebug = false;
g_cGSCurrentState = GS_WARMUP;
}
if(m_cGSstartstate == GS_CAP || p_bResetAllVar) {
if(m_bresetall) {
g_AiCapList[0] = 0;
g_AiCapList[1] = 0;
}
g_iCapForceTemp = 0;
g_flCapRestrictTimer = 0.0;
g_flCapUserMessageTimer = 0.0;
}
}
void UpdatePlayerSettings(m_iclient) {
char p_cCurrentClanTag[MAX_NAME_LENGTH];
CS_GetClientClanTag(m_iclient, p_cCurrentClanTag, sizeof(p_cCurrentClanTag));
if(IsGameStateInBound(GS_WARMUP, GS_GAMEEND)) {
// Clan Tag Force Changer
// * If there is no clan tag, clan tag doesn't change.
char p_cTagRecieverSpec[MAX_NAME_LENGTH],
p_cTagRecieverPlayer[MAX_NAME_LENGTH],
p_cTagRecieverCap[MAX_NAME_LENGTH];
g_cVTagSpectator.GetString(p_cTagRecieverSpec, sizeof(p_cTagRecieverSpec));
g_cVTagPlayer.GetString(p_cTagRecieverPlayer, sizeof(p_cTagRecieverPlayer));
g_cVTagCap.GetString(p_cTagRecieverCap, sizeof(p_cTagRecieverCap));
if(IsSpectator(m_iclient))
if((!IsConVarTagForce() ? (!StrEqual(p_cTagRecieverSpec, "", true)) : true))
if(StrEqual(p_cCurrentClanTag, p_cTagRecieverSpec, true))
CS_SetClientClanTag(m_iclient, p_cTagRecieverSpec);
if(!IsSpectator(m_iclient))
if((!IsConVarTagForce() ? (!StrEqual(p_cTagRecieverPlayer, "", true)) : true))
if(StrEqual(p_cCurrentClanTag, p_cTagRecieverPlayer, true))
CS_SetClientClanTag(m_iclient, p_cTagRecieverPlayer);
if(IsPlayerCap(m_iclient))
if((!IsConVarTagForce() ? (!StrEqual(p_cTagRecieverCap, "", true)) : true))
if(StrEqual(p_cCurrentClanTag, p_cTagRecieverCap, true))
CS_SetClientClanTag(m_iclient, p_cTagRecieverCap);
if(!IsConVarTagForce())
CS_SetClientClanTag(m_iclient, p_cCurrentClanTag);
char p_cDebugTag[50];
CS_GetClientClanTag(m_iclient, p_cDebugTag, 50);
if(g_bDebug) {
char p_sDebugMsg[6][100];
Format(p_sDebugMsg[0], sizeof(p_sDebugMsg[0]), "< p_Variable Section >");
Format(p_sDebugMsg[1], sizeof(p_sDebugMsg[1]), "p_cTagRecieverSpec %s", p_cTagRecieverSpec);
Format(p_sDebugMsg[2], sizeof(p_sDebugMsg[2]), "p_cTagRecieverPlayer %s", p_cTagRecieverPlayer);
Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "p_cTagRecieverCap %s", p_cTagRecieverCap);
Format(p_sDebugMsg[4], sizeof(p_sDebugMsg[4]), "< m_Variable Section >");
Format(p_sDebugMsg[5], sizeof(p_sDebugMsg[5]), "m_iclient %d", m_iclient);
PrintDebugAlert("UpdatePlayerSettings", m_sDebugMsg, 6, DEBUG_ALLCHAT);
}
}
}
void CreateConVars() {
g_cVCapRestrictTimerVal = CreateConVar("pug_cflrestricttimer", "60.0", "Value of Cap restrict timer.");
g_cVTagEnablity = CreateConVar("pug_tiagenable", "2", "Enability of Force Clan tag. Val Type : 0 = Doesn't Enable , 1 = Force Enable , 2 = Enable but no force on empty tags");
g_cVTagCap = CreateConVar("pug_tsagcap", "[ CAP ]", "Pug Tag for Cap");
g_cVTagPlayer = CreateConVar("pug_tsagplayer", "", "Pug Tag for Player");
g_cVTagSpectator = CreateConVar("pug_tsagspec", "[ SPEC ]", "Pug Tag for Spectator");
g_cVCapElectMethod = CreateConVar("pug_cielectmethod", "1", "Method Selection for Cap Election. Val Type : 0 = Only Electing by Admin , 1 = Electing by player volunteers , 2 = Totally Random Election");
g_cVCapRestrictTimerEnablity = CreateConVar("pug_cbrestricttimer", "1", "Enablity of Cap Restrict Timer for Random Cap.");
g_cVCapRandomIgnoreOringal = CreateConVar("pug_cbignoreoriginal", "1", "Ignore the original caps when random cap election is processing.");
g_cVCapUserMessageEnablity = CreateConVar("pug_cbusermsg", "1", "Enablity of User message timer which Message the cap elect method for players who don't know.");
g_cVCapUserMessageTimerVal = CreateConVar("pug_cflusermsg", "5.0", "Value of User message timer.");
}
void HookConVarChanges() {
g_cVCapRestrictTimerVal.AddChangeHook(o_CBcVChange);
g_cVTagEnablity.AddChangeHook(o_CBcVChange);
g_cVTagCap.AddChangeHook(o_CBcVChange);
g_cVTagPlayer.AddChangeHook(o_CBcVChange);
g_cVTagSpectator.AddChangeHook(o_CBcVChange);
g_cVCapElectMethod.AddChangeHook(o_CBcVChange);
g_cVCapRestrictTimerEnablity.AddChangeHook(o_CBcVChange);
g_cVCapRandomIgnoreOringal.AddChangeHook(o_CBcVChange);
g_cVCapUserMessageEnablity.AddChangeHook(o_CBcVChange);
g_cVCapUserMessageTimerVal.AddChangeHook(o_CBcVChange);
}
void CallGameStateShifted(GameState m_cGSCurrentState, bool m_bIsForwarded, GameState m_cGSPreState = GS_DUMMY) {
ResetVariables(true, m_cGSCurrentState);
ResetVariables(false, m_cGSPreState);
if(m_cGSCurrentState == GS_CAP) {
if(m_bIsForwarded) {
if(g_cVCapRestrictTimerEnablity.BoolValue) g_flCapRestrictTimer = GetGameTime() + g_cVCapRestrictTimerVal.FloatValue;
if(g_cVCapElectMethod.IntValue == 2) SelectRandomCap();
if(g_cVCapUserMessageEnablity.BoolValue) g_flCapUserMessageTimer = GetGameTime() + g_cVCapUserMessageTimerVal.FloatValue;
}
}
}
void ShiftGameStateForward() {
GameState p_cGSPreState = g_cGSCurrentState;
if(g_cGSCurrentState == GS_GAMEEND) g_cGSCurrentState = GS_WARMUP;
else g_cGSCurrentState++
CallGameStateShifted(g_cGSCurrentState, true, p_cGSPreState);
if(g_bDebug) {
char p_sDebugMsg[5][100];
Format(p_sDebugMsg[0], sizeof(p_sDebugMsg[0]), "< p_Variable Section >");
Format(p_sDebugMsg[1], sizeof(p_sDebugMsg[1]), "Handle:menu %x", menu);
Format(p_sDebugMsg[2], sizeof(p_sDebugMsg[2]), "p_cGSPreState %d", view_as<int>(p_cGSPreState));
Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "< g_Variable Section >");
Format(p_sDebugMsg[4], sizeof(p_sDebugMsg[4]), "g_cGSCurrentState %d", view_as<int>(g_cGSCurrentState));
PrintDebugAlert("ShiftGameStateForward", m_sDebugMsg, 5, DEBUG_ALLCHAT);
}
}
void ShiftGameStateBackward() {
GameState p_cGSPreState = g_cGSCurrentState;
if(g_cGSCurrentState != GS_WARMUP) g_cGSCurrentState--;
else return;
CallGameStateShifted(g_cGSCurrentState, false, p_cGSPreState);
if(g_bDebug) {
char p_sDebugMsg[5][100];
Format(p_sDebugMsg[0], sizeof(p_sDebugMsg[0]), "< p_Variable Section >");
Format(p_sDebugMsg[1], sizeof(p_sDebugMsg[1]), "Handle:menu %x", menu);
Format(p_sDebugMsg[2], sizeof(p_sDebugMsg[2]), "p_cGSPreState %d", view_as<int>(p_cGSPreState));
Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "< g_Variable Section >");
Format(p_sDebugMsg[4], sizeof(p_sDebugMsg[4]), "g_cGSCurrentState %d", view_as<int>(g_cGSCurrentState));
PrintDebugAlert("ShiftGameStateBackward", m_sDebugMsg, 5, DEBUG_ALLCHAT);
}
}
bool IsGameStateInBound(GameState m_cGSminbound, GameState m_cGSmaxbound) {
if(view_as<int>(m_cGSminbound) <= view_as<int>(g_cGSCurrentState) < view_as<int>(m_cGSmaxbound)) return true;
else return false;
}
int GetInGamePlayers() {
int m_iReturnVal = 0;
for(int i=1; i<=MaxClients; i++) {
if(IsValidClient(i)) if((GetClientTeam(i) != CS_TEAM_SPECTATOR)) m_iReturnVal++
}
return m_iReturnVal;
}
void SelectRandomCap() {
if(GetEmptyCapSlot() == -1) return;
if(g_cGSCurrentState != GS_CAP) return;
if(!g_cVCapRestrictTimerEnablity.BoolValue && g_cVCapElectMethod.IntValue != 2) return;
int p_iMaxPlayers = GetInGamePlayers();
if(!IsCapSlotFullyEmpty()) p_iMaxPlayers -= 1;
bool p_bRandomIgnoreOriginalcVarVal = g_cVCapRandomIgnoreOringal.BoolValue;
int p_iRandomSlot = GetRandomInt(1, p_iMaxPlayers);
int p_iCurrentSlot = 0;
int p_iSlotTeam = CS_TEAM_T;
while(p_bRandomIgnoreOriginalcVarVal ? p_iSlotTeam <= CS_TEAM_CT : GetEmptyCapSlot() != -1) {
p_iRandomSlot = GetRandomInt(1, p_iMaxPlayers);
p_iCurrentSlot = 0;
for(int i=1; i<=MaxClients; i++) if(IsValidClient(i)) if(!IsSpectator(i)) if(!IsPlayerCap(i)) {
p_iCurrentSlot++
if(p_iCurrentSlot == p_iRandomSlot)
g_AiCapList[p_iSlotTeam - 2] = i;
}
p_iMaxPlayers -= 1;
p_iSlotTeam++
}
}
bool IsCapSlotFullyEmpty() {
if(!IsCapFull(CS_TEAM_T) && !IsCapFull(CS_TEAM_CT)) return true;
else return false;
}
int GetEmptyCapSlot() {
int m_iReturnVal = -1;
if(IsCapFull(CS_TEAM_CT)) m_iReturnVal = 0;
if(IsCapFull(CS_TEAM_T)) m_iReturnVal = 1;
if(IsCapFull(CS_TEAM_T) && IsCapFull(CS_TEAM_CT)) m_iReturnVal = -1;
else m_iReturnVal = 0;
return m_iReturnVal;
}
bool IsCapFull(int m_iteam) {
if(g_AiCapList[m_iteam - 2] != 0) return true;
else return false;
}
bool IsPlayerCap(int m_iclient) {
if(g_AiCapList[0] == m_iclient || g_AiCapList[1] == m_iclient) return true;
else return false;
}
bool IsValidClient(int m_iclient, bool m_bnobots = true) {
if(g_bDebug) m_bnobots = false;
if(m_iclient <= 0 || m_iclient > MaxClients || !IsClientConnected(m_iclient) || (m_bnobots && IsFakeClient(m_iclient)))
return false;
return IsClientInGame(m_iclient);
}
bool IsSpectator(int m_iclient, bool m_bnobots = true) {
if(g_bDebug) m_bnobots = false;
if(!IsValidClient(m_iclient)) return false;
if((m_bnobots && IsFakeClient(m_iclient))) return false;
if(GetClientTeam(m_iclient) == CS_TEAM_SPECTATOR) return true;
else return false;
}
bool IsConVarTagForce() {
return (g_cVTagEnablity.IntValue == 1 ? true : false);
}
void PrintDebugMsg() {
if(!g_bDebug) return;
char p_sDebugMsg[2096];
Format(p_sDebugMsg, sizeof(p_sDebugMsg), " >> [ DEBUG ] Real-time Debugger\n");
// Format Info
if(g_cGSCurrentState == GS_CAP) {
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> GameState : %d\n", p_sDebugMsg, view_as<int>(g_cGSCurrentState));
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> GameTime : %f\n", p_sDebugMsg, GetGameTime());
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> g_AiCapList - T : %d\n", p_sDebugMsg, g_AiCapList[0]);
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> g_AiCapList - CT : %d\n", p_sDebugMsg, g_AiCapList[1]);
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> g_iCapForceTemp : %d\n", p_sDebugMsg, g_iCapForceTemp);
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> g_flCapRestrictTimer : %f %f\n", p_sDebugMsg, g_flCapRestrictTimer, g_flCapRestrictTimer - GetGameTime());
Format(p_sDebugMsg, sizeof(p_sDebugMsg), "%s >> g_flCapUserMessageTimer : %f %f\n", p_sDebugMsg, g_flCapUserMessageTimer, g_flCapUserMessageTimer - GetGameTime());
}
// Print
SetHudTextParams(0.05, 0.05, 0.05, 255, 255, 255, 255);
for(new i=1; i<=MaxClients; i++) if(IsValidClient(i)) {
ClearSyncHud(i, g_hDebugHud);
ShowSyncHudText(i, g_hDebugHud, p_sDebugMsg);
SetEntProp(i, Prop_Send, "m_iHideHUD", GetEntProp(i, Prop_Send, "m_iHideHUD") | 1 << 12);
}
}
void PrintDebugAlert(char[] m_sDebugName, char[][] m_sDebugMsg, int m_iFDSize, DebugOutput m_cDOOutputtype = DEBUG_LOG, m_iTarget = 0) {
if(!g_bDebug) return;
char p_sFinalPrint[5096];
if((m_cDOOutputtype & DEBUG_ALLCHAT) || (m_cDOOutputtype & DEBUG_CHAT)) Format(p_sFinalPrint, sizeof(p_sFinalPrint), " \x0A>> \x02[ DEBUG ] \x04Debugging \x07%s \x01...\n\n", m_cDebugName);
else Format(p_sFinalPrint, sizeof(p_sFinalPrint), " >> [ DEBUG ] Debugging %s ...\n\n", m_sDebugName);
for(int i=0; i<=m_iFDSize - 1; i++) {
if((m_cDOOutputtype & DEBUG_ALLCHAT) || (m_cDOOutputtype & DEBUG_CHAT)) Format(p_sFinalPrint, sizeof(p_sFinalPrint), "%s \x0A>> \x02%d \x01| \x04%s\x01\n", p_sFinalPrint, i + 1; m_sDebugMsg[i]);
else Format(p_sFinalPrint, sizeof(p_sFinalPrint), "%s >> %d | %s\n", p_sFinalPrint, i + 1; m_sDebugMsg[i]);
}
if((m_cDOOutputtype & DEBUG_ALLCHAT) || (m_cDOOutputtype & DEBUG_CHAT)) Format(p_sFinalPrint, sizeof(p_sFinalPrint), "\n%s \x0A>> \x02Debug Report \x01is \x04Ended.\x01", p_sFinalPrint);
else Format(p_sFinalPrint, sizeof(p_sFinalPrint), "\n%s >> Debug Report is Ended.", p_sFinalPrint);
if(m_cDOOutputtype & DEBUG_ALLCHAT) PrintToChatAll(p_sFinalPrint);
if(m_cDOOutputtype & DEBUG_CHAT) if(IsValidClient(m_iTarget)) PrintToChat(m_iTarget, p_sFinalPrint);
if(m_cDOOutputtype & DEBUG_HUD) if(IsValidClient(m_iTarget)) {
ClearSyncHud(m_iTarget, g_hDebugAlertHud);
SetHudTextParams(0.85, 0.05, 5.0, 255, 255, 255, 255);
ShowSyncHudText(m_iTarget, g_hDebugAlertHud, p_sFinalPrint);
}
if(m_cDOOutputtype & DEBUG_HUDALL) {
SetHudTextParams(0.85, 0.05, 5.0, 255, 255, 255, 255);
for(int i=1; i<=MaxClients; i++) {
if(IsValidClient(i)) {
ClearSyncHud(i, g_hDebugAlertHud);
ShowSyncHudText(i, g_hDebugAlertHud, p_sFinalPrint);
}
}
}
if(m_cDOOutputtype & DEBUG_LOG) LogMessage(p_sFinalPrint);
}
/*
Error is @
PHP Code:
void DebugForceCapMenu(char[] m_sDebugName, Handle m_hmenu, MenuAction m_cMAaction, int m_iclient, int m_ipos) {
char p_sDebugMsg[11][100];
Format(p_sDebugMsg[0], sizeof(p_sDebugMsg[0]), "< p_Variable Section >");
Format(p_sDebugMsg[1], sizeof(p_sDebugMsg[1]), "Handle:menu %x", m_hmenu);
Format(p_sDebugMsg[2], sizeof(p_sDebugMsg[2]), "MenuAction:action %d", view_as<int>(m_cMAaction));
if(IsValidClient(client)) Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "client %d => %N", m_iclient, m_iclient);
else Format(p_sDebugMsg[3], sizeof(p_sDebugMsg[3]), "Client Invalid");
Format(p_sDebugMsg[4], sizeof(p_sDebugMsg[4]), "pos %d", m_ipos);
Format(p_sDebugMsg[5], sizeof(p_sDebugMsg[5]), "< g_Variable Section >");
Format(p_sDebugMsg[6], sizeof(p_sDebugMsg[6]), "g_cGSCurrentState %d", view_as<int>(g_cGSCurrentState));
Format(p_sDebugMsg[7], sizeof(p_sDebugMsg[7]), "g_AiCapList %d %d", g_AiCapList[0], g_AiCapList[1]);
Format(p_sDebugMsg[8], sizeof(p_sDebugMsg[8]), "g_iCapForceTemp %d", g_iCapForceTemp);
Format(p_sDebugMsg[9], sizeof(p_sDebugMsg[9]), "g_flCapRestrictTimer %2f", g_flCapRestrictTimer);
Format(p_sDebugMsg[10], sizeof(p_sDebugMsg[10]), "g_flCapUserMessageTimer %2f", g_flCapUserMessageTimer);
PrintDebugAlert(m_sDebugName, m_sDebugMsg, 11, DEBUG_ALLCHAT);
}
Help me !
Last edited by NC.svtrade; 04-30-2019 at 14:42.
|
|