Thread: small problem
View Single Post
  #4  
Old 06-09-2009, 07:51 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Well, why are you doing:

PHP Code:
if(player.level in this.localinfo[0][1]){ 
Instead of checking the whole Array?

Also when you start showing a GUI, it'll remain untill it's destroy()ed, and in this script, you're just checking if the GUI should be showed, if yes you show it, if not you don't.

Using a TimeOut here is just unnecessary, I'd suggest you do:

PHP Code:
//#CLIENTSIDE 
function onCreated(){ 
    
this.localinfo = { 
        {
"Electric Workshop""noc_inside-elect.nw"}, 
        {
"Car Workshop""noc_inside-mech-garage.nw"}, 
        {
"Guns Shop""noc_inside-general-store.nw"
    };
    if (
player.level in this.localinfo[0][1]) {
      
ShowGui();
    }

function 
ShowGui() {
  new 
GuiBitmapButtonCtrl("tutorial_button") { 
    
screenwidth 64
    
0
    
width 64
    
height 64
    
normalbitmap "noc_button.png"
    
mouseoverbitmap "noc_button-over.png"
    
pressedbitmap "noc_button-click.png"
  }   
}
function 
onPlayerEnters(){ 
  if (
player.level in this.localinfo[0][1]) { 
    if (!
tutorial_button) {
      
tutorial_button.destroy();
    }
  }
  else { 
    
ShowGui();
  } 

Reply With Quote