I imagine this is what you're going for, I've re-factored your code below. You could create a class called:
events_commands
PHP Code:
function onCreated() {
// Gives your NPC shape on the server-side so
// triggeraction has something to hit.
this.setshape(1, 32, 32);
}
function onActionKickPlayer() {
// Make sure the 'kicker' is on the Events Team
if (player.guild == "Events Team") {
// Get account from first parameter
temp.acc = params[0];
// Kick account
kickPlayer(temp.acc);
}
}
function kickPlayer(acc) {
// Find Player
with (findplayer(acc)) {
// Kick/Relocate Player
player.x = 30;
player.y = 30;
}
}
//#CLIENTSIDE
function onPlayerChats() {
if (player.chat == "/kick") {
for (temp.pl: players) {
if (mousex in | temp.pl.x, temp.pl.x + 3 | && mousey in | temp.pl.y, temp.pl.y + 3 | ) {
// To trigger level npcs you have to use triggeraction like this:
// It will trigger onActionKickPlayer
triggeraction(this.x + 1, this.y + 1, "KickPlayer", temp.pl.account);
}
}
}
}
and place that in your event levels like this:
PHP Code:
function onCreated() {
join("event_commands");
}