Jump to content
  • 0

NPC Show How Many Player Online


Dolphin86

Question


  • Group:  Members
  • Topic Count:  255
  • Topics Per Day:  0.06
  • Content Count:  706
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

hye i would like to request for this npc script, can someone add a chat box on top of the npc and tell how many player are currently online

example : 10 Player Online

neko_isle,93,99,4	script	PlayerOnline	512,{


    query_sql "SELECT `name` , `class` FROM `char` WHERE `online` = '1'", .@name$, .@class;
    mes "-----------------------------------";
    mes "Online Users: " + getusers(1);
    mes "-----------------------------------";
    for( set .@a,0; .@a < getarraysize(.@name$); set .@a,.@a + 1)
        mes .@name$[.@a]+ " | Job: " +jobname(.@class[.@a]);
    mes "-----------------------------------";
    close;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

neko_isle,93,99,4	script	PlayerOnline	512,{
	query_sql "SELECT `name` , `class` FROM `char` WHERE `online` = '1'", .@name$, .@class;
	mes "-----------------------------------";
	mes "Online Users: " + getusers(1);
	mes "-----------------------------------";
	for( set .@a,0; .@a < getarraysize(.@name$); set .@a,.@a + 1)
		mes .@name$[.@a]+ " | Job: " +jobname(.@class[.@a]);
	mes "-----------------------------------";
	close;
	
	OnInit:
	OnPCLoginEvent:
	OnPCLogoutEvent:
		delwaitingroom;
		waitingroom "Online Users: " + getusers(1), 0;
		end;
}

avoid loop ... use the PC login/logoff event instead.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

*getusers(<type>)

This function will return a number of users on a map or the whole server. What
it returns is specified by Type.

Type can be one of the following values, which control what will be returned:

    0 - Count of all characters on the map of the invoking character.
    1 - Count of all characters in the entire server.
    8 - Count of all characters on the map of the NPC the script is
        running in.

Usage :

prontera,150,180,0	script	njhaksdn	123,{
	end;
OnInit:
	while (1) {
		waitingroom "Players Online : "+ getmapusers(1), 0;
		sleep 5000; // updates every 5 sec
		delwaitingroom;
	}
}

 

Edited by Mabuhay
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...