Jump to content
  • 0

SQL peak players HELP


Question

Posted

Hi, I need help with one of my SQL script that's linked to my server's website. It grabs Peak Players from SQL then send the info to my website. I used it way back around 2+ years ago but it seems that it's not working anymore the SQL query is not getting created by the script . Can anyone help me to get this script to work again?

 

Here's the script

//Highest Peak
-	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)
		{
			set .highestPeak,.currentUsersOL;		
			query_sql("UPDATE `cp_highest_peak`SET num_users='"+.highestPeak+"',peak_date='"+.date$+"'"); //Insert new highest Peak
		}
	}
end;

}

 

Thank you in advance!

4 answers to this question

Recommended Posts

  • 0
Posted
24 minutes ago, Yami said:

Hi, I need help with one of my SQL script that's linked to my server's website. It grabs Peak Players from SQL then send the info to my website. I used it way back around 2+ years ago but it seems that it's not working anymore the SQL query is not getting created by the script . Can anyone help me to get this script to work again?

 

Here's the script


//Highest Peak
-	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)
		{
			set .highestPeak,.currentUsersOL;		
			query_sql("UPDATE `cp_highest_peak`SET num_users='"+.highestPeak+"',peak_date='"+.date$+"'"); //Insert new highest Peak
		}
	}
end;

}

 

Thank you in advance!

it should already inside github for FluxCP.

https://github.com/rathena/FluxCP/blob/master/data/npc/PeakNPC.txt

 

Run/load it in your npc folder.

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