Hey Guys,
Have a slight problem,
Trying to get this script to work, to run for every player on round_start
It stops after the first person, Will post what i've got.
PHP Code:
HookEvent("round_start", RunTest);
public RunTest(Handle:event, const String:name[], bool:dontBroadcast)
{
for (new idx = 0; idx <= MaxClients; idx++)
{
PrintToChatAll("Player found");
// check if person is in game and not in spec
if (IsClientConnected(idx))
{
PrintToChatAll("Player is client");
// Get the target team
decl String:teamString[3];
GetCmdArg(1, teamString, sizeof(teamString));
new Target_Team = StringToInt(teamString);
decl String:sCookie[5];
GetClientCookie(idx, g_CT_Cookie, sCookie, sizeof(sCookie));
new iBanStatus = StringToInt(sCookie);
// check for an active ban to send a mesage
if ((Target_Team == 1 || Target_Team == 2) && iBanStatus)
{
PrintToChatAll("Player is Terrorist or Spec");
// display them a message about the ban
new iTimeBanned = GetClientCookieTime(idx, g_CT_Cookie);
decl String:sTimeBanned[150];
FormatTime(sTimeBanned, sizeof(sTimeBanned), NULL_STRING, iTimeBanned);
decl String:sJoinBanMsg[100];
GetConVarString(gH_Cvar_JoinBanMessage, sJoinBanMsg, sizeof(sJoinBanMsg));
PrintHintText(idx, "%t", "Last CT Banned On", sTimeBanned, sJoinBanMsg);
}
// otherwise they joined CT or auto-select and are banned
else if (iBanStatus)
{
PrintToChatAll("Player is Counter-Terrorist");
if(strcmp(gS_SoundPath, ""))
{
decl String:buffer[PLATFORM_MAX_PATH + 5];
Format(buffer, sizeof(buffer), "play %s", gS_SoundPath);
ClientCommand(idx, buffer);
}
PrintCenterText(idx, "%t", "Enforcing CT Ban");
UTIL_TeamMenu(idx);
return Plugin_Continue;
}
return Plugin_Continue;
}
}
return Plugin_Continue;
}
So basically, i want if they join the CT Team, and they're on this banned list, that it brings up the UTIL_TeamMenu.
I don't know where i've gone wrong. (Perhaps coding after a 15 hour shift and being awake for 27 hours.)
Thanks
Paul