Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 10:45 AM.


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