Issues:
1. You shouldn't have code outside of functions, code placed like that is executed every time an event occurs.
2. You're comparing player.chat to itself, which is effectively the same as doing if (true) which is pointless.
3. player.chat is a variable not a function.
4. The way your loop is setup on the client-side you're sending (playercount+ircbots) triggers to the server which is really bad.
5. Code isn't indented properly.
PHP Code:
//Scripted by Emera. Chat Customizer!
function ActionServerSide() {
if ( params[0] == "chat" ) {
player.chat(params[1]); // Issue 3: player.chat is a variable not a function.
}
}
//#CLIENTSIDE
function onPlayerChats() {
// Issue 5: Code isn't indented properly.
if (player.chat == player.chat) { // Issue 2: Comparing player.chat to itself, will always evaluate be true.
player.chat = "Emera: "@player.chat;
}
}
// Issue 1: Code outside of a function.
for ( temp.p : allplayers ) { // Issue 4: Will send (playercount + ircbots) amount of triggerservers. You should only need to send one.
with (temp.p) {
triggerServer( "gui", this.name, "chat", message );
}
}
Re-arranged and fixed issues:
PHP Code:
function ActionServerSide() {
if ( params[0] == "chat" ) {
for (temp.p: allplayers) {
with (temp.p) {
player.chat = params[1];
}
}
}
}
//#CLIENTSIDE
function onPlayerChats() {
triggerserver("gui", this.name, "chat", player.chat);
}
I believe the above is what you were aiming for.