Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-04-2011, 10:58 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Mouse over for names and info

It basically just shows their nick, account and if there staff their position
add accounts in this.staffposition for their names to have a rank.
PHP Code:
//#CLIENTSIDE
function onCreated() {
//This is a list of ranks, add graal accounts to it as you please.
  
this.lats = {
    
"Graal######"
  
};
  
this.admins = {
    
"Graal######"
  
};
  
this.nats = {
    
"Graal######"
  
};
  
this.gfx = {
    
"Graal######"
  
};
  
this.sfx = {
    
"Graal######"
  
};
  
this.eventsteam = {
    
"Graal######"
  
};
  
onTimeout();
}

function 
onTimeout() {
//Hides the info so that if your mouse isnt over players they wont show.
  
Player_Name.hide();
  
Player_Account.hide();
  
Admin_Ranks.hide();
  
LAT_Ranks.hide();
  
NAT_Ranks.hide();
  
GFX_Ranks.hide();
  
Events_Team_Ranks.hide();
  
SFX_Ranks.hide();
//Checks if your mouse is over a player.
  
for (temp.plfindNearestPlayers(mousexmousey)) {
    if (
mousex in pl.xpl.2.5 | && mousey in pl.ypl.| ) {
//Creates the gui's to show.
      
new GuiTextCtrl("Player_Name") {
        
profile GuiBlueTextProfile;
        
height 20;
        
text "Name:       " temp.pl.nick;
        
width 200;
        
mousescreenx 15;
        
mousescreeny 5;
        
red 1;
        
green 1;
        
blue 1;
        
alpha 1;
      }
      new 
GuiTextCtrl("Player_Account") {
        
profile GuiBlueTextProfile;
        
height 20;
        
text "Account:   " temp.pl;
        
width 200;
        
mousescreenx 15;
        
mousescreeny 10;
        
red 1;
        
green 1;
        
blue 1;
        
alpha 1;
      }
//Shows "Rank: Staffrank" if your account is listed above.
      
if (temp.pl.account in this.admins) {
        new 
GuiTextCtrl("Admin_Ranks") {
          
profile GuiBlueTextProfile;
          
height 20;
          
text "Rank:         Admin";
          
width 200;
          
mousescreenx 15;
          
mousescreeny 25;
          
red 1;
          
green 1;
          
blue 1;
          
alpha 1;
          
Admin_Ranks.show();
        }
      }
      if (
temp.pl.account in this.lats) {
        new 
GuiTextCtrl("LAT_Ranks") {
          
profile GuiBlueTextProfile;
          
height 20;
          
text "Rank:        LAT";
          
width 200;
          
mousescreenx 15;
          
mousescreeny 25;
          
red 1;
          
green 1;
          
blue 1;
          
alpha 1;
          
LAT_Ranks.show();
        }
      }
      if (
temp.pl.account in this.nats) {
        new 
GuiTextCtrl("NAT_Ranks") {
          
profile GuiBlueTextProfile;
          
height 20;
          
text "Rank:        NAT";
          
width 200;
          
mousescreenx 15;
          
mousescreeny 25;
          
red 1;
          
green 1;
          
blue 1;
          
alpha 1;
          
NAT_Ranks.show();
        }
      }
      if (
temp.pl.account in this.gfx) {
        new 
GuiTextCtrl("GFX_Ranks") {
          
profile GuiBlueTextProfile;
          
height 20;
          
text "Rank:        GFX";
          
width 200;
          
mousescreenx 15;
          
mousescreeny 25;
          
red 1;
          
green 1;
          
blue 1;
          
alpha 1;
          
GFX_Ranks.show();
        }
      }
      if (
temp.pl.account in this.sfx) {
        new 
GuiTextCtrl("SFX_Ranks") {
          
profile GuiBlueTextProfile;
          
height 20;
          
text "Rank:        SFX";
          
width 200;
          
mousescreenx 15;
          
mousescreeny 25;
          
red 1;
          
green 1;
          
blue 1;
          
alpha 1;
          
SFX_Ranks.show();
        }
      }
      if (
temp.pl.account in this.eventsteam) {
        new 
GuiTextCtrl("Events_Team_Ranks") {
          
profile GuiBlueTextProfile;
          
height 20;
          
text "Rank:         Events Team";
          
width 200;
          
mousescreenx 15;
          
mousescreeny 25;
          
red 1;
          
green 1;
          
blue 1;
          
alpha 1;
          
Events_Team_Ranks.show();
        }
      }
//Shows players name and account regardless of it there staff.
      
Player_Name.show();
      
Player_Account.show();
    }
  }
//Loops it so its checking constantly if your mouse is on a player.
  
settimer(0.05);

Any feedback is appreciated
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion

Last edited by Gunderak; 09-04-2011 at 04:01 PM..
Reply With Quote
  #2  
Old 09-04-2011, 04:44 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Constantly re-creating the GUIs is not a good idea.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
// list stuff
  
createGUIs();
}

function 
createGUIs() {
  
// create GUIs here
    // set visible to false in each GUI
}

function 
onTimeout() {
  
// make the GUI you need visible
  // set it's X and Y position

You really only need one GUI object for Staff Rank and should just change the text based on what list they're in.
__________________
Quote:
Reply With Quote
  #3  
Old 09-05-2011, 01:05 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
ah i see what your going at, only making them visible when needed.
so create them all in on created and then on a timeout choose weather to show them or not.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
Reply


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 02:31 PM.


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