Yes and no, to answer the question in the thread title. Classes can also be joined to weapons, so theoretically, it works in classes. But it doesn't in level NPCs. You will have to do something along the lines of this:
PHP Code:
function onActionExample()
echo("I was triggered on the serverside!");
function onCreated()
setShape(1, 32, 32);
//#CLIENTSIDE
function onCreated() {
setShape(1, 32, 32);
triggerAction(this.x, this.y, "Example", nil);
}
There are important things to note though:
- you need a shape on the serverside (I usually add the same on the clientside too)
- the action may not be named "Serverside" or "Clientside", that won't work