Thread: small problem
View Single Post
  #1  
Old 06-09-2009, 05:30 PM
Seich Seich is offline
Noctorious' NeoHunter
Seich's Avatar
Join Date: Jun 2008
Location: Honduras
Posts: 193
Seich will become famous soon enough
Send a message via MSN to Seich Send a message via Yahoo to Seich
small problem

Hello, recently I've been working with a weapon npc which, is supposed to show a gui bitmap button when a player enters certain levels. The problem is that, even thought I manage to display the button when I am on one of those levels, I haven't been able to remove the button when the player leaves the level. I've tried two different approaches and, none worked as expected. My first approach was to loop through an array with the levels and test if the level was in the array. My second approach was using the onPlayerEnters event and check is the player was on one of those levels. The second method worked fine, but I am unable to make it so the button disappears after the player leaves the level. any suggestions?

PHP Code:
//#CLIENTSIDE
function onCreated(){
    
this.tut_place false;
    
this.localinfo = {
        {
"Electric Workshop""noc_inside-elect.nw"},
        {
"Car Workshop""noc_inside-mech-garage.nw"},
        {
"Guns Shop""noc_inside-general-store.nw"}
    };
}

function 
onPlayerEnters(){
        if(
player.level in this.localinfo[0][1]){
            
this.tut_place true;
        }else{
            
//this.tut_place = false;
        
}
    
setTimer(.5);
}

function 
onTimeout(){
        if(
this.tut_place){
        if(!
tutorial_button.visible){
            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";
            }
        }
    }else{
        
tutorial_button.destroy();
    }
    
setTimer(.5);

Reply With Quote