Make sure you indent/style your scripts properly, there's even a style command on RC for that but when you get the hang of it, you'll style your code automatically as you type.
PHP Code:
//#CLIENTSIDE
function onKeyPressed(num1, key, num2)
{
if (key == "x")
{
ar = {player.x + (vecx(player.dir) * 2) + 1.1,
player.y + (vecy(player.dir) * 2) + 1.1};
triggeraction(ar[0], ar[1], "Sticked");
setani("haven_staffstick",NULL);
freezeplayer(0.4);
sleep(0.4);
}
}
Now before you start getting into bad habits, reduce your usage of triggers to the absolute minimal. As you can see I removed your destroyblock trigger.
For hitting NPCs with it:
PHP Code:
function onActionSticked() {
echo("was hit by staff stick!");
}
But now that works well for NPCs you need to use a weapon npc, and add it to the player, then use a script like this.
PHP Code:
//#CLIENTSIDE
function onActionSticked() {
player.chat = "was hit by the staff stick";
}
But that won't warp the player to your osl, so you'll need to tell the client to do some server interaction. Here's an example of a weapon npc that would warp the player to OSL.
PHP Code:
function onActionServerSide() {
if (params[0] == "warptoOSL") {
// Warps Player to OSL
player.setlevel2("onlinestartlocal.nw", 30, 30);
}
}
//#CLIENTSIDE
function onCreated() {
warptoOSL();
}
function warptoOSL() {
// Sends Trigger to Server
triggerserver("gui", name, "warptoOSL");
}
There I have presented the pieces to you, now you put it together
