View Single Post
  #2  
Old 08-09-2011, 08:10 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The first thing you need to fix is the terribly inconsistent styling.

Also, you should just use PHP tags for code that's not too long to post.

PHP Code:
function onActionServerSide( cmd )
{
  if ( 
cmd == "getLogtext" )
  {
   
temp.l.loadLines( "logs/systemmass.txt" );
    
triggerclient( "gui", name, "returnLogtext", temp.l );
    }
    }

//#CLIENTSIDE
function onCreated()
{
triggerserver( "gui", name, "getLogtext" );
}
function 
showMessage( news )
{
  new 
GuiWindowCtrl("LogReader_Window")
  {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "589,516";
    
isexternal = false;

    
canclose = true;
    
canmaximize = false;
    
canmove = true;
    
canresize = false;
    
closequery = false;
    
destroyonhide = false;
    
text = "Log Reader";
    
x = 370;
    
y = 72;

    new 
GuiScrollCtrl("LogReader_MultiLine_Scroll")
    {
      
profile = GuiBlueScrollProfile;
      
height = 504;
      
hscrollbar = "dynamic";
      
vscrollbar = "dynamic";
      
width = 576;
      
x = 6;
      
y = 7;

      new 
GuiMLTextCtrl("LogReader_MultiLine")
      {
        
profile = GuiBlueMLTextProfile;
        
height = 17;
        
horizsizing = "width";
        
plaintext = "";
        
text = news;
        
width = 551;
      }
    }
  }
}
function 
onPlayerChats()
{
if (
player.chat == "/showlog")
{
if(!(
LogReader_Window.visible))
{
LogReader_Window.visible = true;
player.chat = "";
}
}
if (
player.chat == "/hidelog")
{
if (
LogReader_Window.visible)
{
LogReader_Window.visible = false;
player.chat = "";
}
}
}


function 
onActionClientSide( cmd, l )
{
  if ( 
cmd == "returnLogtext" )
  {
    for ( 
temp.a : l )
    {
      
temp.ne @= temp.a @ "\n";
    }
    
showMessage( temp.ne );
      }
      
setimer(0.05);
}
function 
onWeaponFired()
{
triggerserver( "gui", name, "getLogtext" );
} 
Cleaned up a bit:

PHP Code:
function onActionServerSide(cmd) {
  if (
cmd == "getLogtext") {
    
temp.l.loadLines("logs/systemmass.txt");
    
triggerclient("gui", name, "returnLogtext", temp.l);
  }
}

//#CLIENTSIDE
function onCreated() {
  
triggerserver("gui", name, "getLogtext");
}

function 
showMessage(news) {
  new 
GuiWindowCtrl("LogReader_Window") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "589,516";
    
isexternal = false;

    
canclose = true;
    
canmaximize = false;
    
canmove = true;
    
canresize = false;
    
closequery = false;
    
destroyonhide = false;
    
text = "Log Reader";
    
x = 370;
    
y = 72;

    new 
GuiScrollCtrl("LogReader_MultiLine_Scroll") {
      
profile = GuiBlueScrollProfile;
      
height = 504;
      
hscrollbar = "dynamic";
      
vscrollbar = "dynamic";
      
width = 576;
      
x = 6;
      
y = 7;

      new 
GuiMLTextCtrl("LogReader_MultiLine") {
        
profile = GuiBlueMLTextProfile;
        
height = 17;
        
horizsizing = "width";
        
plaintext = "";
        
text = news;
        
width = 551;
      }
    }
  }
}

function 
onPlayerChats() {
  if (
player.chat == "/showlog") {
    if (!(
LogReader_Window.visible)) {
      
LogReader_Window.visible = true;
      
player.chat = "";
    }
  }
  if (
player.chat == "/hidelog") {
    if (
LogReader_Window.visible) {
      
LogReader_Window.visible = false;
      
player.chat = "";
    }
  }
}


function 
onActionClientSide(cmd, l) {
  if (
cmd == "returnLogtext") {
    for (
temp.a: l) {
      
temp.ne @= temp.a @ "\n";
    }
    
showMessage(temp.ne);
  }
  
setimer(0.05);
}

function 
onWeaponFired() {
  
triggerserver("gui", name, "getLogtext");
} 
What's with the (misspelled) setTimer command in onActionClientSide?
__________________

Last edited by cbk1994; 08-09-2011 at 08:25 PM..
Reply With Quote