Thread: Help Meh
View Single Post
  #4  
Old 07-26-2009, 12:21 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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(num1keynum2)
{
  if (
key == "x")
  {
    
ar = {player.+ (vecx(player.dir) * 2) + 1.1,
          
player.+ (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"3030);
  }
}
//#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
__________________
Quote:
Reply With Quote