Thread: Simple Safe
View Single Post
  #1  
Old 10-12-2008, 11:51 PM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Simple Safe

Intended for a class. Just a quick one I threw together, and some player wanted it. So... Here it is

PHP Code:
function onActionServerSideafiacc )
{
  switch( 
afi )
  {
    case 
"allowPlayer":
    {
      
temp.findPlayeracc );
      if ( 
player.account == "Your account here" )
      {
        
temp.i.clientr.canWithdraw 1;
        
temp.i.chat "I can now withdraw from the safe!";
      }
     break;
    }
    case 
"disallowPlayer":
    {
      
temp.findPlayeracc );
      if ( 
player.account == "" )
      {
        
temp.i.chat "I'm not allowed to withdraw from the safe anymore!";
        
temp.i.clientr.canWithdraw 0;
      }
     break;
    }
  }
}

function 
onCreated()
{
  
setImg"" ); // Your safe image
  
setShape13232 );
}

function 
onPlayerChats()
{
  
temp.tokens player.chat.tokenize();
  if ( 
player.chat.starts":allow" ) )
  {
    
triggerServer"gui"name"allowPlayer"temp.tokens] );
    
player.chat "You allowed:" SPC temp.tokensSPC "to withdraw from the safe!";
  }
  if ( 
player.chat.starts":disallow" ) )
  {
    
triggerServer"gui"name"disallowPlayer"temp.tokens] );
    
player.chat "You have disallowed:" SPC temp.tokensSPC "to withdraw from the safe!";
  }
  if ( 
player.chat.starts":donate" ) )
  {
    
this.moneyAdd temp.tokens];
    if ( 
clientr.item.Money >= this.moneyAdd )
    {
      if ( 
this.moneyAdd )
      {
        
this.safeMoney += this.moneyAdd;
        
player.rupees -= this.moneyAdd;
        
onShowMoney();
        
saveLog2"logs/safeDonate.txt""Player:" SPC player.account SPC "donated:" SPC temp.tokensSPC "at:" SPC player.level.name "!" );
      }
        else
      {
        
player.chat "You can't donate a negative amount!";
      }
    }
      else
    {
      
player.chat "You don't have enough money to donate this amount!";
    }
  }
  if ( 
player.chat.starts":withdraw" ) )
  {
    
this.takeMoney temp.tokens];
    if ( 
this.safeMoney >= this.takeMoney )
    {
      if ( 
this.takeMoney )
      {
        if ( 
clientr.canWithdraw == )
        {
          
player.rupees += this.takeMoney;
          
this.safeMoney -= this.takeMoney;
          
saveLog2"logs/safeWithdraw.txt""Player:" SPC player.account SPC "withdrew" SPC temp.tokensSPC "at:" SPC player.level.name );
          
onShowMoney();
        }
          else
        {
          
player.chat "You're not allowed to withdraw from the safe!";
        }
      }
        else
      {
        
player.chat "You can't withdraw a negative amount!";
      }
    }
      else
    {
      
player.chat "There isn't that much money in the safe!";
    }
  }
}

function 
onShowMoney()
{
  
showText1x.5"Arial""bc""There is $" this.safeMoney SPC "in the safe!" );

Feel free to point out mistakes.

Last edited by devilsknite1; 10-13-2008 at 03:57 AM..
Reply With Quote