//GET MAIN SCORE
for (var m:Number = 0; m <= 3;) {
scoreArray[4]+=scoreArray[m]
++m;
}
function RoundScore(){
for (var i:Number = 0; i <= 4;) {
ScoreH = Math.floor(scoreArray[i]/3600000);
remaining = scoreArray[i]-(ScoreH*3600000);
//minutes
ScoreM = Math.floor(remaining/60000);
remaining = remaining-(ScoreM*60000);
//seconds
ScoreS = Math.floor(remaining/1000);
remaining = remaining-(ScoreS*1000);
//hundredths
ScoreH = Math.floor(remaining/10);
if (ScoreM<10) {
ScMins = "0"+ScoreM.toString();
} else {
ScMins = ScoreM.toString();
}
if (ScoreS<10) {
ScSecs = "0"+ScoreS.toString();
} else {
ScSecs = ScoreS.toString();
}
if (ScoreH<10) {
ScHunds = "0"+ScoreH.toString();
} else {
ScHunds = ScoreH.toString();
}
if(i==0)(Round1Sc=ScMins+":"+ScSecs+":"+ScHunds);
if(i==1)(Round2Sc=ScMins+":"+ScSecs+":"+ScHunds);
if(i==2)(Round3Sc=ScMins+":"+ScSecs+":"+ScHunds);
if(i==3){Round4Sc=ScMins+":"+ScSecs+":"+ScHunds};
if(i==4){PlayerSc=ScMins+":"+ScSecs+":"+ScHunds;}//MAIN SCORE
++i;
}
PScore.text=PlayerSc;//MAIN SCORE
Round1Score.text=Round1Sc;
Round2Score.text=Round2Sc;
Round3Score.text=Round3Sc;
Round4Score.text=Round4Sc;
}
RoundScore();
//////////////////////////////////////////////////
////ENTERING THE SCORE INTO DATABASE
//Define the Score Variable here
score = PScore.text;
//Edit this to destination after score is submitted.
//It currently just Disables the submit button.
function submitcomplete() {
TrackInfo.gotoAndStop(12);
}
//Here is the function to submitscore. DO NOT CHANGE.
function submitscore() {
//New Variables to be Loaded
var anticheat:LoadVars = new LoadVars();
//Defining which Variables will be Loaded
anticheat.score = score;
anticheat.username = username;
anticheat.action = 'anticheat';
//Function when Data is Loaded
anticheat.onLoad = function () {
//Defining Echoed Variables
chkscore = anticheat.chkscore
chkusername = anticheat.chkusername
//Checking if Data from PHP Matches Original Data
if(score != anticheat.chkscore || username != anticheat.chkusername) {
//Doesn't Match. Therefore Cheating.
status = "Cheating";
} else {
//Does Match. Carry on.
//New Set of Variables to be Loaded
var subscore:LoadVars = new LoadVars();
//Variables to be Loaded
subscore.score = score;
subscore.username = username;
subscore.action = 'sendscore';
//Function when Variables are Loaded
subscore.onLoad = function() {
//Change Status to whatever PHP Defined
status = subscore.status;
//Submition Completed. Function once done.
//You Can define this at the top of this script
submitcomplete();
}
//Load Variables to PHP
//The Null and Random Number makes it so the computer doesn't rememer past uses.
subscore.sendAndLoad("hsfuncs.php?null="+random(99999), subscore, "POST");
}
}
//Load Variables to PHP
//The Null and Random Number makes it so the computer doesn't rememer past uses.
anticheat.sendAndLoad("hsfuncs.php?null="+random(99999), anticheat, "POST");
}
|