Jump to content
  • 0

SQL peak players HELP


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

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!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1530
  • Reputation:   234
  • Joined:  08/03/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

16 minutes ago, Amir Azman said:

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.

I'm not sure if this script will connect to the one I have for my website tho ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1530
  • Reputation:   234
  • Joined:  08/03/12
  • Last Seen:  

3 hours ago, Yami said:

I'm not sure if this script will connect to the one I have for my website tho ?

make sure u already installed fluxcp latest version or run this SQL

https://github.com/rathena/FluxCP/blob/master/data/schemas/charmapdb/cp_onlinepeak.20131120120201.sql

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Thank you will try this ASAP!

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