Jump to content
  • 0

NPC Show How Many Player Online


Question

Posted

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;
}

 

2 answers to this question

Recommended Posts

  • 1
Posted
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.

  • 0
Posted (edited)
*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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...