PDA

View Full Version : ADD flag A to players who get VIP tag HELP


Alex101192
11-06-2020, 05:43
There is a problem with this code here. It displays admin tag just fine but not for flag A vips since it's missing the reservation check. So I put ADMFLAG_RESERVATION inside the else if but nothing happened. Help please.

public void OnPluginStart()
{
AddCommandListener(OnPlayerChatCheck, "say");
AddCommandListener(OnPlayerTeamChatCheck, "say_team");
}

public void OnPluginEnd()
{
RemoveCommandListener(OnPlayerChatCheck, "say");
RemoveCommandListener(OnPlayerTeamChatCheck, "say_team");
}

public Action OnPlayerChatCheck(int client, const char[] command, int args)
{
if (client == 0 || args == 0)
{
return Plugin_Continue;
}

if (!IsClientInGame(client))
{
return Plugin_Handled;
}

char sChatText[192];
GetCmdArgString(sChatText, sizeof(sChatText));
StripQuotes(sChatText);

if ((GetUserFlagBits(client) & ADMFLAG_GENERIC) || (GetUserFlagBits(client) & ADMFLAG_KICK) || (GetUserFlagBits(client) & ADMFLAG_ROOT))
{
if (sChatText[0] == '/')
{
return Plugin_Handled;
}

PrintToChatAll("\x04[ADMIN] \x05%N\x01: %s", client, sChatText);
return Plugin_Handled;
}
else if ((GetUserFlagBits(client) & ADMFLAG_CUSTOM1) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM2) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM3) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM4) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM5) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM6))
{
if (sChatText[0] == '/')
{
return Plugin_Handled;
}

PrintToChatAll("\x04[VIP] \x05%N\x01: %s", client, sChatText);
return Plugin_Handled;
}

return Plugin_Continue;
}

public Action OnPlayerTeamChatCheck(int client, const char[] command, int args)
{
if (client == 0 || args == 0)
{
return Plugin_Continue;
}

if (!IsClientInGame(client))
{
return Plugin_Handled;
}

char sChatText[192];
GetCmdArgString(sChatText, sizeof(sChatText));
StripQuotes(sChatText);

if ((GetUserFlagBits(client) & ADMFLAG_GENERIC) || (GetUserFlagBits(client) & ADMFLAG_KICK) || (GetUserFlagBits(client) & ADMFLAG_ROOT))
{
if (sChatText[0] == '/')
{
return Plugin_Handled;
}

for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || GetClientTeam(i) != GetClientTeam(client) || IsFakeClient(i))
{
continue;
}

PrintToChat(i, "\x03%s \x04[A]\x05 %N\x01: %s", (GetClientTeam(client) != 2) ? ((GetClientTeam(client) == 3) ? "(Infected)" : "(Spectators)") : "(Survivors)", client, sChatText);
}
return Plugin_Handled;
}
else if ((GetUserFlagBits(client) & ADMFLAG_CUSTOM1) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM2) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM3) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM4) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM5) || (GetUserFlagBits(client) & ADMFLAG_CUSTOM6))
{
if (sChatText[0] == '/')
{
return Plugin_Handled;
}

for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || GetClientTeam(i) != GetClientTeam(client) || IsFakeClient(i))
{
continue;
}

PrintToChat(i, "\x03%s \x04[VIP]\x05 %N\x01: %s", (GetClientTeam(client) != 2) ? ((GetClientTeam(client) == 3) ? "(Infected)" : "(Spectators)") : "(Survivors)", client, sChatText);
}
return Plugin_Handled;
}

return Plugin_Continue;
}

GsiX
11-06-2020, 13:43
i m not quite follow, but assuming the flag A carry the tag VIP then the argument ADMFLAG_RESERVATION goes in line with ADMFLAG_CUSTOM1 follow by || (or operator). Have you try?

Edit: This belong to the moon landing engineering team scripting section.