Bonsoir à tous,
Je suis en élaboration d'un système assez complet concernant les cryptos monnaies ; Mais j'aimerais quelques renseignements concernant les requêtes server -> client en exemple voici mes actions effectuées
[CODE lang="cpp" title="fn_initbtc"]if (!(playerSide isEqualTo civilian)) exitWith { closeDialog 0; };
createDialog "Life_Btc_Menu";[/CODE]
[CODE lang="cpp" title="fn_transfertmenubtc"]/*
File: fn_transfertmenubtc.sqf
Author: Azira
Description:
Transfert Menu
*/
disableSerialization;
if (!(dialog)) exitWith { closeDialog 0; };
waitUntil { createDialog "Life_Btc_Transfert"; };
_display = findDisplay 131221445; // DISPLAY ENTER MENU TRANSFERT
_ctrl = _display displayCtrl 5001; // COMPTE BANCAIRE
_ctrl2 = _display displayCtrl 5002; // COMPTE CRYPTO
_ctrl4 = _display displayCtrl 5004; // VALIDER
_ctrl ctrlSetText [format ["%1",life_atmbank] call life_fnc_numberText];
_ctrl2 ctrlSetText [format ["%1",missionNamespace getVariable ["life_bitcoin",0]] call life_fnc_numberText];[/CODE]
[CODE lang="cpp" title="fn_transfertbtc"]disableSerialization;
params [
["_bitcoin", 0, [0.0]]
];
/////////////////////////////
// DIALOG
////////////////////////////
_display = findDisplay 131221445; // DISPLAY ENTER MENU TRANSFERT
_ctrl = _display displayCtrl 5001; // COMPTE BANCAIRE
_ctrl2 = _display displayCtrl 5002; // COMPTE CRYPTO
_ctrl3 = _display displayCtrl 5003; // AMOUNT
_amount = parseNumber(ctrlText 5003);
/////////////////////////////
// CODE
////////////////////////////
if (_amount isEqualTo []) exitwith { ctrlSetText [5003, ["Indique un montant"]]; };
if (life_atmbank >= _amount) then {
_result = _amount * 0.0001 + _bitcoin;
life_atmbank = life_atmbank - _amount;
missionNamespace setVariable ["life_bitcoin",_result];
diag_log format ["Mise à jour Query envoyée : Result C : %1 / _bitcoin I : %2",_result,_bitcoin];
} else {
systemChat "Vous n'avez pas les fonds nécessaires";
};
_ctrl ctrlSetText [format ["%1",life_atmbank] call life_fnc_numberText];
_ctrl2 ctrlSetText [format ["%1",missionNamespace getVariable ["life_bitcoin",0]] call life_fnc_numberText];
/////////////////////////////
// SAUVEGARDE BDD
////////////////////////////
[_result] remoteExec ["life_fnc_requestbtc",2];[/CODE]
[CODE title="fn_requestbtc"]
params [
["_result", 0, [0.0]]
];
private _uid = getPlayerUID player;
private _query = format ["SELECT bitcoin FROM bitcoin WHERE uid='%1'",_uid];
private _queryResult = [_query,2] call DB_fnc_asyncCall;
if (_queryResult isEqualTo []) then {
_query = format ["INSERT INTO bitcoin (uid, bitcoin) VALUES('%1', '%2')",_uid,_result];
[_query,1] call DB_fnc_asyncCall;
} else {
query = format ["UPDATE bitcoin SET bitcoin='%2' WHERE uid='%1'", _uid,_result];
[_query, 1] call DB_fnc_asyncCall;
};[/CODE]
J'ai deux questions déjà est-ce que mon fn_requestbtc est viable ? De plus mon but est de récupérer mes valeurs bdd sur fn_transfertbtc & fn_balancebtc comme indiqué ci-dessous
[CODE lang="cpp" title="fn_balancebtc"]/*
File: fn_balancebtc.sqf
Author: Azira
Description:
Balance
*/
disableSerialization;
params [
["_bitcoin", 0, [0.0]]
];
/////////////////////////////
// DIALOG
////////////////////////////
_display = findDisplay 131221178; // DISPLAY ENTER MENU TRANSFERT
_ctrl = _display displayCtrl 5001; // COMPTE BANCAIRE
_ctrl2 = _display displayCtrl 5002; // COMPTE CRYPTO
_ctrl ctrlSetText [format ["%1",life_atmbank] call life_fnc_numberText];
_ctrl2 ctrlSetText [format ["%1",_bitcoin] call life_fnc_numberText];
[/CODE]
Si je donne plus de détails :
Le param > comment puis-je le récup sur la bdd ?
[CODE lang="cpp" title="fn_transfertbtc"]params [
["_bitcoin", 0, [0.0]]
];[/CODE]
[CODE lang="cpp" title="fn_balancebtc"]params [
["_bitcoin", 0, [0.0]]
];[/CODE]
Je suis en élaboration d'un système assez complet concernant les cryptos monnaies ; Mais j'aimerais quelques renseignements concernant les requêtes server -> client en exemple voici mes actions effectuées
[CODE lang="cpp" title="fn_initbtc"]if (!(playerSide isEqualTo civilian)) exitWith { closeDialog 0; };
createDialog "Life_Btc_Menu";[/CODE]
[CODE lang="cpp" title="fn_transfertmenubtc"]/*
File: fn_transfertmenubtc.sqf
Author: Azira
Description:
Transfert Menu
*/
disableSerialization;
if (!(dialog)) exitWith { closeDialog 0; };
waitUntil { createDialog "Life_Btc_Transfert"; };
_display = findDisplay 131221445; // DISPLAY ENTER MENU TRANSFERT
_ctrl = _display displayCtrl 5001; // COMPTE BANCAIRE
_ctrl2 = _display displayCtrl 5002; // COMPTE CRYPTO
_ctrl4 = _display displayCtrl 5004; // VALIDER
_ctrl ctrlSetText [format ["%1",life_atmbank] call life_fnc_numberText];
_ctrl2 ctrlSetText [format ["%1",missionNamespace getVariable ["life_bitcoin",0]] call life_fnc_numberText];[/CODE]
[CODE lang="cpp" title="fn_transfertbtc"]disableSerialization;
params [
["_bitcoin", 0, [0.0]]
];
/////////////////////////////
// DIALOG
////////////////////////////
_display = findDisplay 131221445; // DISPLAY ENTER MENU TRANSFERT
_ctrl = _display displayCtrl 5001; // COMPTE BANCAIRE
_ctrl2 = _display displayCtrl 5002; // COMPTE CRYPTO
_ctrl3 = _display displayCtrl 5003; // AMOUNT
_amount = parseNumber(ctrlText 5003);
/////////////////////////////
// CODE
////////////////////////////
if (_amount isEqualTo []) exitwith { ctrlSetText [5003, ["Indique un montant"]]; };
if (life_atmbank >= _amount) then {
_result = _amount * 0.0001 + _bitcoin;
life_atmbank = life_atmbank - _amount;
missionNamespace setVariable ["life_bitcoin",_result];
diag_log format ["Mise à jour Query envoyée : Result C : %1 / _bitcoin I : %2",_result,_bitcoin];
} else {
systemChat "Vous n'avez pas les fonds nécessaires";
};
_ctrl ctrlSetText [format ["%1",life_atmbank] call life_fnc_numberText];
_ctrl2 ctrlSetText [format ["%1",missionNamespace getVariable ["life_bitcoin",0]] call life_fnc_numberText];
/////////////////////////////
// SAUVEGARDE BDD
////////////////////////////
[_result] remoteExec ["life_fnc_requestbtc",2];[/CODE]
[CODE title="fn_requestbtc"]
params [
["_result", 0, [0.0]]
];
private _uid = getPlayerUID player;
private _query = format ["SELECT bitcoin FROM bitcoin WHERE uid='%1'",_uid];
private _queryResult = [_query,2] call DB_fnc_asyncCall;
if (_queryResult isEqualTo []) then {
_query = format ["INSERT INTO bitcoin (uid, bitcoin) VALUES('%1', '%2')",_uid,_result];
[_query,1] call DB_fnc_asyncCall;
} else {
query = format ["UPDATE bitcoin SET bitcoin='%2' WHERE uid='%1'", _uid,_result];
[_query, 1] call DB_fnc_asyncCall;
};[/CODE]
J'ai deux questions déjà est-ce que mon fn_requestbtc est viable ? De plus mon but est de récupérer mes valeurs bdd sur fn_transfertbtc & fn_balancebtc comme indiqué ci-dessous
[CODE lang="cpp" title="fn_balancebtc"]/*
File: fn_balancebtc.sqf
Author: Azira
Description:
Balance
*/
disableSerialization;
params [
["_bitcoin", 0, [0.0]]
];
/////////////////////////////
// DIALOG
////////////////////////////
_display = findDisplay 131221178; // DISPLAY ENTER MENU TRANSFERT
_ctrl = _display displayCtrl 5001; // COMPTE BANCAIRE
_ctrl2 = _display displayCtrl 5002; // COMPTE CRYPTO
_ctrl ctrlSetText [format ["%1",life_atmbank] call life_fnc_numberText];
_ctrl2 ctrlSetText [format ["%1",_bitcoin] call life_fnc_numberText];
[/CODE]
Si je donne plus de détails :
Le param > comment puis-je le récup sur la bdd ?
[CODE lang="cpp" title="fn_transfertbtc"]params [
["_bitcoin", 0, [0.0]]
];[/CODE]
[CODE lang="cpp" title="fn_balancebtc"]params [
["_bitcoin", 0, [0.0]]
];[/CODE]
Dernière édition: