Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-13-2006, 08:20 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Warpto System

Simple warpto system.
PHP Code:
function onActionServerside() 
{
  if (
params[0] == "warptolocal"
  {
    
player.params[1];
    
player.params[2];
    
savelog2("warplog_"@player.account,player.account SPC "warped to"
              
SPC params[1SPC params[2SPC "in" SPC player.level);
  }
  else if (
params[0] == "warptolevel"
  {
    
setlevel2(params[3],params[1],params[2]);
    
savelog2("warplog_"@player.account,player.account SPC "warped to" SPC params[3]);
    
  }

  else if (
params[0] == "warptoplayer"
  {      
    
with (findplayer(params[1])) 
    {
      
thiso.warplevel player.level;
      
thiso.warpx player.x;
      
thiso.warpy player.y;                 
    }
    if (
this.warplevel != NULL)
    {
      
setlevel2(this.warplevel,this.warpx,this.warpy);
      
savelog2("warplog_"@player.account,player.account SPC "warped to" SPC params[1]);
      
this.warplevel this.warpx this.warpy null;
    }
    else 
player.chat "Player is not online";
  }
}   

//#CLIENTSIDE
function onPlayerchats() 
{
  
tokens player.chat.tokenize();
  if (
player.chat.starts("/warpto")) 
  {
    if (
tokens.size() == "2"
    {
      
triggeraction(0,0,"serverside","-warpto","warptoplayer",tokens[1]);
      }
    else if (
tokens.size() == "3"
    {
      
triggeraction(0,0,"serverside","-warpto","warptolocal",tokens[1],tokens[2]);
    }
    else if (
tokens.size() == "4"
    {
      
triggeraction(0,0,"serverside","-warpto","warptolevel",tokens[1],tokens[2],tokens[3]);
    }
    else 
    {
      
player.chat "Not a Valid Warp";
    }    
  }

I didn't add any account tests as it's up to the server to decide how to do it.
I would use a DBNPC and make a test like StaffRights.warptest(player.account,warptype);

Anyone know a decent method for checking if a level exists? Thinking of fileexists() or similar. Made harder by the fact some servers have many folders with levels

Anywho... pm in graal (not forums) if you want something custom...like having certain levels disallowed or similar.
Reply With Quote
  #2  
Old 09-13-2006, 07:29 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Twinny
Anyone know a decent method for checking if a level exists? Thinking of fileexists() or similar. Made harder by the fact some servers have many folders with levels
levelexists( string level )
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #3  
Old 09-14-2006, 08:30 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Ahhh cheers <3
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.