Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 08-02-2007, 08:01 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
You need to send messages to other players through the serverside, doing it clientside is only getting their player object as its shown to you.
__________________
Reply With Quote
  #3  
Old 08-02-2007, 08:57 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
Ah, thank you Inverness. Worked perfectly. =D
__________________


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
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 09:59 PM.


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