My code is not working - messages are not showing up. Can somebody help me ?
PHP Code:
public Action:Command_SendToAll(client, args)
{
if((IsPlayerGenericAdmin(client)) && GetConVarBool(tagczat))
{
new String:text[256];
GetCmdArg(1, text, sizeof(text));
if(text[0] == '/' || text[0] == '@' || text[0] == '!' || text[0] == 0 || IsChatTrigger())
{
return Plugin_Handled;
}
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && IsClientConnected(i))
{
if(GetClientTeam(client) == GetClientTeam(i))
{
if(IsPlayerAlive(client) && GetClientTeam(client) != 1)
{
if(CheckCommandAccess(client, "sm_ban", ADMFLAG_BAN))
{
PrintToChatAll("[A]%N: %s", client, text);
} else {
PrintToChatAll("[V]%N: %s", client, text);
}
} else if(!IsPlayerAlive(client) && GetClientTeam(client) != 1)
{
if(CheckCommandAccess(client, "sm_ban", ADMFLAG_BAN))
{
PrintToChat(i,"DEAD [A]%N: %s", client, text);
} else {
PrintToChat(i,"DEAD [V]%N: %s", client, text);
}
} else if(!IsPlayerAlive(client) && GetClientTeam(client) == 1)
{
if(CheckCommandAccess(client, "sm_ban", ADMFLAG_BAN))
{
PrintToChat(i, "SPECT [A]%N: %s", client, text);
return Plugin_Handled;
} else {
PrintToChat(i, "SPECT [V]%N: %s", client, text);
return Plugin_Handled;
}
}
return Plugin_Handled;
}
return Plugin_Handled;
}
return Plugin_Handled;
}
}
return Plugin_Continue;
}
I wanna :
1. Alive players can send messages to all players (alive+dead+spect) and can only see messages from alive players
2. Dead players can send messages to deads and spects.
3. Spects can send messages to dead and spects.
I think that my IF is good. Something is wrong with [i] and (client).
It's part of my code that hook "say". My other part that hook "say_team" is working well.