Jump to content
  • 0

NPC that shows how many users are in the map


Question

Posted (edited)

Hello everyone. I would like to request an NPC that shows how many users are in the map.
It's like a normal NPC that has chat waiting room that has a message like "40 Players are in the Prontera"
Something like that. Thanks.

Hi everyone. I would like to request an npc that shows how many users are online.
It's like an NPC that has a Chat waiting room that says "50 Players are online"
Thanks in advance. Ciao
 

Edited by Conflicts
Merged Topics / Posts: Conflicts

6 answers to this question

Recommended Posts

Posted

Not tested.

prontera,150,150,4	script	Map Player Counter	88,{
	end;
OnInit:
    	while(1) {
	delwaitingroom;
	waitingroom "Map Counter [ ^FF0000"+getmapusers("prontera")+"^000000 ]",0;
	sleep 1500; //1.5 seconds
	}
	end;
}
  • Upvote 1
Posted

 

Not tested.

prontera,150,150,4	script	Map Player Counter	88,{
	end;
OnInit:
    	while(1) {
	delwaitingroom;
	waitingroom "Map Counter [ ^FF0000"+getmapusers("prontera")+"^000000 ]",0;
	sleep 1500; //1.5 seconds
	}
	end;
}

Thanks. I'll try it asap. 

How about if i want to make it server wide. So players can know how many people are in the server atm. 

Thanks alot Ford. 

I have merged both topics, refrain from posting multiple topics with the same intent / request.

 

Thanks men. Appreciated. Sorry bout that.  /no1

Posted

Other way..

CREATE TABLE IF NOT EXISTS `cp_highest_peak` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `num_users` int(10) unsigned NOT NULL DEFAULT '0',
  `peak_date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE = MYISAM;

and now the script is here

//====================================================================================
//Script Name: Server Online Users Highest Peak
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP Server Highest Addon
//Description: This npc script will record the highest number of players that your server reach
//====================================================================================
- script Highest Peak -,{

OnPCLoginEvent:


set .currentUsersOL,getusers(1); //Current Online Users

//Query for the highest peak in the database
query_sql("SELECT `num_users` FROM `cp_highest_peak` ORDER BY `num_users` LIMIT 1",.@numUsers);
//Get the date
set .date$,gettime(7)+"-"+gettime(6)+"-"+gettime(5); 

set .highestPeak,.@numUsers[0]; //Highest Peak
if(getarraysize(.@numUsers) == 0)
{
//If not data found Insert statement
set .highestPeak,.currentUsersOL;
query_sql("INSERT INTO `cp_highest_peak`(num_users,peak_date) VALUES("+.highestPeak+",'"+.date$+"')"); //Insert new highest Peak
}
else
{
if(.currentUsersOL>.highestPeak)
{
announce ""+.currentUsersOL,bc_all;
set .highestPeak,.currentUsersOL; 
query_sql("UPDATE `cp_highest_peak`SET num_users='"+.highestPeak+"',peak_date='"+.date$+"'"); //Insert new highest Peak
}
}
end;

}
  • Upvote 1
Posted

 

Other way..

CREATE TABLE IF NOT EXISTS `cp_highest_peak` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `num_users` int(10) unsigned NOT NULL DEFAULT '0',
  `peak_date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE = MYISAM;

and now the script is here

//====================================================================================
//Script Name: Server Online Users Highest Peak
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP Server Highest Addon
//Description: This npc script will record the highest number of players that your server reach
//====================================================================================
- script Highest Peak -,{

OnPCLoginEvent:


set .currentUsersOL,getusers(1); //Current Online Users

//Query for the highest peak in the database
query_sql("SELECT `num_users` FROM `cp_highest_peak` ORDER BY `num_users` LIMIT 1",.@numUsers);
//Get the date
set .date$,gettime(7)+"-"+gettime(6)+"-"+gettime(5); 

set .highestPeak,.@numUsers[0]; //Highest Peak
if(getarraysize(.@numUsers) == 0)
{
//If not data found Insert statement
set .highestPeak,.currentUsersOL;
query_sql("INSERT INTO `cp_highest_peak`(num_users,peak_date) VALUES("+.highestPeak+",'"+.date$+"')"); //Insert new highest Peak
}
else
{
if(.currentUsersOL>.highestPeak)
{
announce ""+.currentUsersOL,bc_all;
set .highestPeak,.currentUsersOL; 
query_sql("UPDATE `cp_highest_peak`SET num_users='"+.highestPeak+"',peak_date='"+.date$+"'"); //Insert new highest Peak
}
}
end;

}

 

Thanks men. Appreciated.  /no1

Just replace the getmapusers("prontera") by getusers(1)

 

Cool. It works.  /no1

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...