mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Adding files
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
@font-face {
|
||||
font-family: pcdown;
|
||||
src: url('pdown.ttf');
|
||||
}
|
||||
body {
|
||||
font-family: roboto;
|
||||
}
|
||||
#cursor {
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
display: none;
|
||||
}
|
||||
#menu {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
#menu {
|
||||
display : flex;
|
||||
flex-direction: column;
|
||||
width : 500px;
|
||||
height : 150px;
|
||||
margin-top : -75px;
|
||||
margin-left: -250px;
|
||||
}
|
||||
#menu div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
#deposit_btn {
|
||||
width : 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
#deposit_amount {
|
||||
width : 250px;
|
||||
height : 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
#withdraw_btn {
|
||||
width : 250px;
|
||||
height: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
#withdraw_amount {
|
||||
width : 250px;
|
||||
height : 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 272 B |
Binary file not shown.
@@ -0,0 +1,78 @@
|
||||
var documentWidth = document.documentElement.clientWidth;
|
||||
var documentHeight = document.documentElement.clientHeight;
|
||||
|
||||
var cursor = document.getElementById("cursor");
|
||||
var cursorX = documentWidth / 2;
|
||||
var cursorY = documentHeight / 2;
|
||||
|
||||
function UpdateCursorPos() {
|
||||
cursor.style.left = cursorX;
|
||||
cursor.style.top = cursorY;
|
||||
}
|
||||
|
||||
function Click(x, y) {
|
||||
var element = $(document.elementFromPoint(x, y));
|
||||
element.focus().click();
|
||||
}
|
||||
|
||||
$(document).mousemove(function(event) {
|
||||
cursorX = event.pageX;
|
||||
cursorY = event.pageY;
|
||||
UpdateCursorPos();
|
||||
});
|
||||
|
||||
window.onload = function(e){
|
||||
// NUI Callback
|
||||
window.addEventListener('message', function(event){
|
||||
let data = event.data;
|
||||
if(data.showControls){
|
||||
$('#container').show();
|
||||
$('#menu' ).hide();
|
||||
$(cursor ).hide();
|
||||
}
|
||||
if(data.showMenu){
|
||||
$('#container' ).show();
|
||||
$('#menu' ).show();
|
||||
$(cursor ).show();
|
||||
$('#deposit_amount').val(data.player.money)
|
||||
let bankAmount = 0;
|
||||
for(let i=0; i<data.player.accounts.length; i++)
|
||||
if(data.player.accounts[i].name == 'bank')
|
||||
bankAmount = data.player.accounts[i].money;
|
||||
if(bankAmount >= 10000)
|
||||
$('#withdraw_amount').val(10000)
|
||||
else
|
||||
$('#withdraw_amount').val(bankAmount)
|
||||
}
|
||||
|
||||
if(data.hideAll){
|
||||
$('#container').hide();
|
||||
$(cursor ).hide();
|
||||
}
|
||||
if (data.click) {
|
||||
// Avoid clicking the cursor itself, click 1px to the top/left;
|
||||
Click(cursorX - 1, cursorY - 1);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
document.onkeyup = function (data) {
|
||||
if (data.which == 27) {
|
||||
$.post('http://esx_atm/escape', '{}');
|
||||
}
|
||||
};
|
||||
|
||||
$('#container').hide()
|
||||
|
||||
$('#deposit_btn').click(() => {
|
||||
$.post('http://esx_atm/deposit', JSON.stringify({
|
||||
amount: $('#deposit_amount').val()
|
||||
}));
|
||||
})
|
||||
|
||||
$('#withdraw_btn').click(() => {
|
||||
$.post('http://esx_atm/withdraw', JSON.stringify({
|
||||
amount: $('#withdraw_amount').val()
|
||||
}));
|
||||
})
|
||||
@@ -0,0 +1,28 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" href="css/app.css" type="text/css" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Catamaran:400,700" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<img id="cursor" src="img/cursor.png">
|
||||
<div id="container">
|
||||
<div id="menu">
|
||||
<div>
|
||||
<input type="text" id="deposit_amount"/>
|
||||
<button id="deposit_btn">Déposer</button>
|
||||
</div>
|
||||
<br><br>
|
||||
<div>
|
||||
<input type="text" id="withdraw_amount"/>
|
||||
<button id="withdraw_btn">Retirer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
|
||||
<script src="scripts/app.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user