PHP Code:
public Action foo
{
for (int i = 0; i < sizeof(BadWord); i++)
{
bar;
bar:
bar;
return Plugin_Handled;
}
return Plugin_Handled;
}
you see it?
You have a pre-mature return in your for loop
Also the "return Plugin_Changed" needs to go.
I'm not sure what it does, but if it's important, you should rather define a flag before your for and then check what to return afterwards:
PHP Code:
public Action OnChatMessage(int& author, Handle recipients, char[] name, char[] message)
{
bool changesMade = false;
for (int i = 0; i < sizeof(BadWord); i++)
{
char newMessage[256];
strcopy(newMessage, sizeof(newMessage), message);
if(StrContains(newMessage, BadWord[i]))
{
ReplaceString(newMessage, sizeof(newMessage), BadWord[i], BadWordReplace);
changesMade = true;
}
}
if(changesMade)
return Plugin_Changed;
else
return Plugin_Handled;
}