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;
}
Question
Yami
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.