21.02.2017, 05:41
Hi,
This code is using to withdraw money and get them in game. So i need understand how to create php scripts?
withdrawMoneyUid = data;
What id i need to assign here? i mean in php file withdraw.php what i have to return? i don't ask to create all php script, just tell my what principe it works, how to give in game player money?
Код:
var withdrawMoneyCheckInterval = null; var withdrawMoneyUid = 0; var blockWithdraw = false; function withdrawMoneyCheck() { $.post("http://anywebsitebla.lt/app/get_withdraw.php", {name: userName, uid: withdrawMoneyUid, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data ) { var newUserData = parseINIString(data); if(newUserData["success"] == "0") return; clearInterval(withdrawMoneyCheckInterval); withdrawMoneyCheckInterval = null; withdrawMoneyUid = 0; if(newUserData["success"] == "1") { showMsg("You have money in your pocket!"); userData["money"] = newUserData["money"]; userData["money_bank"] = newUserData["money_bank"]; } else if(newUserData["success"] == "-1") { showWarningMsg("You need play in server!"); } else if (newUserData["success"] == "-2") { blockWithdraw = true; showWarningMsg("An authorization error!"); } }); } function withdrawMoney() { if(blockWithdraw) { showWarningMsg("Do not!"); return; } if(withdrawMoneyCheckInterval != null) { showWarningMsg("Please wait!"); return; } var amount = parseInt(document.getElementById("withdrawAmount").value); if(amount > userData["money_bank"]) { showWarningMsg("You don't have enought money! In bank you have: " + userData["money_bank"] + " EUR"); return; } if(amount > 100000000) { showWarningMsg("Too big ammount!"); return; } if(amount < 1000) { showWarningMsg("Minimum ammount 1.000 EUR!"); return; } var PIN = document.getElementById("bankPIN").value; if(PIN < 1000) PIN = 0; document.getElementById("withdrawAmount").value = ''; document.getElementById("bankPIN").value = ''; $("#leftpanelMoneyWithdraw").panel("close"); $.post("http://anywebsitebla.lt/app/withdraw.php", {name: userName, token: userData["token"], PIN: PIN, amount: amount, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data ) { if (data == "0") { showWarningMsg("Server unavailable!"); return; } else if (data == "-1") { blockWithdraw = true; showWarningMsg("An authorization error!"); return; } else { withdrawMoneyUid = data; showMsg("order is sent successfully!"); withdrawMoneyCheckInterval = setInterval (withdrawMoneyCheck, 11000); } }); }
withdrawMoneyUid = data;
What id i need to assign here? i mean in php file withdraw.php what i have to return? i don't ask to create all php script, just tell my what principe it works, how to give in game player money?