Thread: Mini Lotto
View Single Post
  #1  
Old 04-19-2006, 12:24 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Mini Lotto

I'm making a mini lotto game for DR. The script works for 1 NPC, but put more than one in a level, and ALL of them trigger the test action. Why??
PHP Code:

// NPC made by Excaliber
function onCreated()
{
  
setshape(1,32,32);
}
function 
onActiontest()
{
  
playerrupees-=1;
  
this.minilotto_num1=int(random(0,9));
  
this.minilotto_num2=int(random(0,9));
  
this.minilotto_num1*=10;
  
this.minilotto_num=this.minilotto_num1+this.minilotto_num2;
  if(
client.minilotto_num==this.minilotto_num)
  {
    
chat="JACKPOT!";
    
with(findplayer(player.account))
    {
      
play extra.wav//doesn't work
      
playerrupees+=51//does work
    
}
  }
  else
  {
    
chat="Nothing this time... Last number: "@this.minilotto_num;
  }
}
//#CLIENTSIDE
function onPlayertouchsme()
{
  if(
playerrupees>0)
  {
    
chat="Playing";
    
client.minilotto_num=0;
    
mini_lotto.showtop();
    new 
GuiWindowCtrl("mini_lotto")
    {
      
//gui window stuff

        
new GuiButtonCtrl("roll")
        {
          
//roll button stuff
        
}
        new 
GuiTextEditCtrl("p1num")
        {
         
//text stuff
        
}
      new 
GuiTextEditCtrl("p2num")
        {
          
//text stuff
        
}
      }
    }
  }
  function 
roll.onAction()
  {
    
//var setup
    
triggeraction(x,y,"test","test");
  } 
Reply With Quote