Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   actionplayer question (https://forums.graalonline.com/forums/showthread.php?t=56325)

prozac424242 12-06-2004 08:46 PM

actionplayer question
 
For the control npc on my server
I want something to happen when the player logs out.
it's not actionplayeroffline,
(which you think would work since actionplayeronline works for the login)

What is the flag triggered to the server when a player logs out?

Also is there a refrence to serverside commands and flags in a file that someone can post?

Dach 12-06-2004 08:53 PM

There isn't one, you just need to do a allplayerscount check in a loop and all that. Well, atleast untill the new version, where I'd assume something like this, if not already available, could easily be added via script.

ZeroTrack 12-06-2004 09:26 PM

Something like this is a good way to check
PHP Code:

if (createdtimeout=0.1;

if (
timeout) {
  for (
a=0;a<allplayerscount;a++) {
    
with (allplayers[a]) {
      if (
strlen(#F)>0)
        
if(!strcontains(#s(this.tempplayers),#a)) addstring this.tempplayers,#a;
    
}
  }
  
logon();
  
logoff();
  
setstring this.tempplayers,;
  
timeout=1;
}
function 
logon() {
  
tokenize #s(this.tempplayers);
  
for (a=0;a<tokenscount;a++) {
    if (!
strcontains(#s(this.players),#t(a))){
      
addstring this.players,#t(a);
    
}
  }
}
function 
logoff() {
  
tokenize #s(this.players);
  
for (a=0;a<tokenscount;a++) {
    if (!
strcontains(#s(this.tempplayers),#t(a))) {
      
removestring this.players,#t(a);
    
}
  }



zokemon 12-07-2004 07:36 PM

Quote:

Originally Posted by ZeroTrack
Something like this is a good way to check
PHP Code:

if (createdtimeout=0.1;

if (
timeout) {
  for (
a=0;a<allplayerscount;a++) {
    
with (allplayers[a]) {
      if (
strlen(#F)>0)
        
if(!strcontains(#s(this.tempplayers),#a)) addstring this.tempplayers,#a;
    
}
  }
  
logon();
  
logoff();
  
setstring this.tempplayers,;
  
timeout=1;
}
function 
logon() {
  
tokenize #s(this.tempplayers);
  
for (a=0;a<tokenscount;a++) {
    if (!
strcontains(#s(this.players),#t(a))){
      
addstring this.players,#t(a);
    
}
  }
}
function 
logoff() {
  
tokenize #s(this.players);
  
for (a=0;a<tokenscount;a++) {
    if (!
strcontains(#s(this.tempplayers),#t(a))) {
      
removestring this.players,#t(a);
    
}
  }



Looks VERY similar to my npc on Bravo with the exception of a few string names...

Slash-P2P 12-07-2004 11:02 PM

I made a nice who logged out npc before. I dont care who logs out though, so I took it down.

zokemon 12-08-2004 02:56 AM

And then I made it again (not a copy just typed my own up... much like the one I put on bravo)
But Slash and I are cool so... <3

ZeroTrack 12-08-2004 03:07 AM

Quote:

Originally Posted by zokemon
Looks VERY similar to my npc on Bravo with the exception of a few string names...

thats cause it is yours =p , MD tried to say it was his haha

zokemon 12-08-2004 08:54 PM

Quote:

Originally Posted by ZeroTrack
thats cause it is yours =p , MD tried to say it was his haha

Ahh.. :)

Velox Cruentus 01-01-2005 02:47 PM

Hrm -- You shouldn't be too bothered by the players logging out -- By all case, it would case a lot of lag checking the entire list repeatedly... Perhaps make the timeout equal 5 instead of 1, if at all useful.

Admins 01-07-2005 05:52 PM

In the new scripting engine on clientside you have the event actionplayerlogout, the player object is deleted 5 seconds after the player logs out instead of immediatelly removing it. That needed to be added to make the scripted playerlist work.
Something similar will be added to npcserver sometime, although there it is a little bit more complex because both gserver and npcserver would need to keep the player object in the memory so that you can still do modifications on the player which are also saved on hard disk.


All times are GMT +2. The time now is 09:51 PM.

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