Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Talk about annoying =/ (https://forums.graalonline.com/forums/showthread.php?t=69989)

KuJi 11-10-2006 04:50 AM

Talk about annoying =/
 
Okay, I am making the client handle who logs on/off to add a message saying they did such. Problem is, either IRC is showing up, or RC is showing up.

PHP Code:

function onPlayerLogin(newUser)
{
  if (
newUser.starts("irc:"))
  {
    return 
false;
  }
  
  for (
temp.var: allplayers)
  { 
    if (
temp.var == newUser)
    {
      
temp.found true;
      
      break;
    }
  }
  
  if (
temp.found)
  {
    
player.addMsg("Server"format("%s has logged on!"newUser), 15);
  }
}

function 
onPlayerLogout(newUser)
{
  if (
newUser.starts("irc:"))
  {
    return 
false;
  }
  
  for (
temp.var: allplayers)
  {
    if (
temp.var == newUser)
    {
      
temp.found true;
      
      break;
    }
  }
  
  if (
temp.found)
  {
    
player.addMsg("Server"format("%s has logged off!"newUser), 15);
  }


That method shows RC's logging on, and no logging off at all =(

Skyld 11-10-2006 10:16 AM

Try the player.isexternal flag; this should help you filter out IRC users. As for RCs, just check that the player.level.name == "" or so.

KuJi 11-10-2006 03:01 PM

Quote:

Originally Posted by Skyld (Post 1241514)
Try the player.isexternal flag; this should help you filter out IRC users. As for RCs, just check that the player.level.name == "" or so.

That would stop logging out I think.

Skyld 11-10-2006 05:51 PM

Quote:

Originally Posted by KuJi (Post 1241546)
That would stop logging out I think.

Which part?

player.isexternal is for checking if the player is logged onto the current server, or if the "player" is an IRC user or channel, etc. You don't write to it. You just read it.
PHP Code:

if (player.isExternal)
{
  echo(
"You are an IRC user or a global playerlist member");



KuJi 11-10-2006 11:09 PM

Quote:

Originally Posted by Skyld (Post 1241577)
Which part?

player.isexternal is for checking if the player is logged onto the current server, or if the "player" is an IRC user or channel, etc. You don't write to it. You just read it.
PHP Code:

if (player.isExternal)
{
  echo(
"You are an IRC user or a global playerlist member");



The player's level.. I think.

I mean, normally if it was possible i could just do
PHP Code:

function onPlayerLogin(temp.plyr)
{
  if (
temp.plyr.level != "")
  {
    
// Not an IRC + Global Buddy + RC
  
}


But that doesn't work, or it didn't..


All times are GMT +2. The time now is 02:14 PM.

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