Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-02-2007, 06:37 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Message System

My first time ever really making a message system. And I have a simple problem. Players can't see other players chat. They can see their own chat. But not OTHER player's chats.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.stdmsgtime 5;
  
this.msglimit 6;
  
player.msgs.clear();

  
onTimeout();
}

function 
onPlayerChats() {
  if (
player.chat != "") {
    if (!
player.chat.starts("/global") && !player.chat.starts("/whisper")) {
      
addMsg({"local"player.accountplayer.chat});
    }
  }
}

public function 
addMsg(msginfo) {
  switch (
msginfo[0]) {
    case 
"local":
      for (
pl players) {
        if (
pl.level != null || pl.account == player.account) {
          
temp.msg "(Local) " msginfo[1] @ " says: " msginfo[2];
          
with (findplayer(pl.account)) {
            
msgs.add({thiso.stdmsgtimetemp.msg});
            
msgupdate true;
          }
        }
      }
    break;
  }
}

function 
onTimeout() {
  
updateTime();
  if (
player.msgupdate == true) {
    
updateText();
  }
  
setTimer(1);
}

function 
updateTime() {
  if (
player.msgs != null) {
    for (
0player.msgs.size(); i++) {
      if (
player.msgs[i][0] > 0) {
        
player.msgs[i][0]--;
      }
      else if (
player.msgs[i][0] != -&& player.msgs[i][0] < 1) {
        
player.msgs.delete(i);
        
player.msgupdate true;
      }
    }
  }
}

function 
updateText() {
  
hideimgs(200207);
  if (
player.msgs != null) {
    if (
player.msgs.size() >  this.msglimit) {
      
player.msgs null;
      
player.msgupdate true;
    }
    else {
      for (
0player.msgs.size(); i++) {
        if (
player.msgs[i] != null) {
          
showtext(200 i5, (GraalControl.height 25) - (18 i), "Arial"""player.msgs[i][1]);
          
changeimgvis(200 i5);
          
changeimgzoom(200 i0.5);
        }
      }
    }
  }

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
 


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 12:34 AM.


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