Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
heshan-basnayaka authored Aug 27, 2021
1 parent 5fbc583 commit fbb0226
Show file tree
Hide file tree
Showing 6 changed files with 572 additions and 0 deletions.
73 changes: 73 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
local inWebView = false
local WebView = {}

WebView.Open = function()
SendNUIMessage({
action = "open"
})
SetNuiFocus(true, true)
inWebView = true
end

WebView.Close = function()
SendNUIMessage({
action = "close"
})
SetNuiFocus(false, false)
inWebView = false
end

WebView.DrawText3Ds = function(coords, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(coords.x, coords.y, coords.z, 0)
DrawText(0.0, 0.0)
local factor = (string.len(text)) / 370
DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
ClearDrawOrigin()
end

RegisterNUICallback('close', function()
SetNuiFocus(false, false)
inWebView = false
end)

local inRange = false



local creatingCompany = false
local currentName = nil
Citizen.CreateThread(function()
while true do

local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
inRange = false

local dist = #(pos - Config.Webcoords.coords)

if dist < 20 then
inRange = true
DrawMarker(2, Config.Webcoords.coords.x, Config.Webcoords.coords.y, Config.Webcoords.coords.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.2, 155, 152, 234, 155, false, false, false, true, false, false, false)
if #(pos - vector3(Config.Webcoords.coords.x, Config.Webcoords.coords.y, Config.Webcoords.coords.z)) < 1.5 then
WebView.DrawText3Ds(Config.Webcoords.coords, '~g~E~w~ - Web view')
if IsControlJustPressed(0, 38) then
WebView.Open()
end
end
end

if not inRange then
Citizen.Wait(1000)
end

Citizen.Wait(2)
end
end)

8 changes: 8 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Config = Config or {}

Config.CompanyPrice = 25000

Config.Webcoords = {
coords = vector3(274.8, -330.37, 44.92)
}

23 changes: 23 additions & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
fx_version 'cerulean'
game 'gta5'

description 'Script By 3UR3K4'
version '1.0.0'

ui_page 'html/index.html'

shared_scripts {

'config.lua'
}

server_script 'server/main.lua'
client_script 'client/main.lua'

files {
'html/*.js',
'html/*.html',
'html/*.css',


}
159 changes: 159 additions & 0 deletions html/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
var WebView = {}
var mouseOver = false;
var selectedIdentity = null;
var selectedIdentityType = null;
var selectedJob = null;
var selectedJobId = null;

WebView.Open = function(data) {
$(".container").fadeIn(150);
}

WebView.Close = function() {
$(".container").fadeOut(150, function(){
WebView.ResetPages();
});
$.post('https://Web-View/close');

$(selectedJob).removeClass("job-selected");
$(selectedIdentity).removeClass("job-selected");
}

WebView.ResetPages = function() {
$(".webview-option-blocks").show();
$(".webview-identity-page").hide();
$(".webview-job-page").hide();
}

$(document).ready(function(){
window.addEventListener('message', function(event) {
switch(event.data.action) {
case "open":
WebView.Open(event.data);
break;
case "close":
WebView.Close();
break;
}
})
});

$(document).on('keydown', function() {
switch(event.keyCode) {
case 27: // ESC
WebView.Close();
break;
}
});

$('.webview-option-block').click(function(e){
e.preventDefault();

var blockPage = $(this).data('page');

$(".webview-option-blocks").fadeOut(100, function(){
$(".webview-"+blockPage+"-page").fadeIn(100);
});

if (blockPage == "identity") {
$(".identity-page-blocks").html("");
$(".identity-page-blocks").html('<div class="identity-page-block" data-type="id_card"><p>Birth Certificate</p></div>');

$.post('https://Web-View/requestLicenses', JSON.stringify({}), function(licenses){
$.each(licenses, function(i, license){
var elem = '<div class="identity-page-block" data-type="'+license.idType+'"><p>'+license.label+'</p></div>';
$(".identity-page-blocks").append(elem);
});
});
}
});

$(document).on("click", ".identity-page-block", function(e){
e.preventDefault();

var idType = $(this).data('type');

selectedIdentityType = idType;

if (selectedIdentity == null) {
$(this).addClass("identity-selected");
$(".hover-description").fadeIn(10);
selectedIdentity = this;
if (idType == "id_card") {
$(".request-identity-button").fadeIn(100);
$(".request-identity-button").html("<p>Click Here to Buy a Birth Certificate for $50</p>")
} else if (idType == "driver_license") {
$(".request-identity-button").fadeIn(100);
$(".request-identity-button").html("<p>Click Here to Buy a Driver License for $50</p>")
} else if (idType == "weaponlicense") {
$(".request-identity-button").fadeIn(100);
$(".request-identity-button").html("<p>Click Here to Buy a Firearms License for $50</p>")
}
} else if (selectedIdentity == this) {
$(this).removeClass("identity-selected");
selectedIdentity = null;
$(".request-identity-button").fadeOut(100);
} else {
$(selectedIdentity).removeClass("identity-selected");
$(this).addClass("identity-selected");
selectedIdentity = this;
if (idType == "id_card") {
$(".request-identity-button").html("<p>You paid $50 for a Birth Certificate</p>")
} else if (idType == "driver_license") {
$(".request-identity-button").html("<p>You paid $50 for a Driver License</p>")
} else if (idType == "weaponlicense") {
$(".request-identity-button").html("<p>You paid $50 for a Firearms License</p>")
}
}
});

$(".request-identity-button").click(function(e){
e.preventDefault();

$.post('https://Web-View/requestId', JSON.stringify({
idType: selectedIdentityType
}))

WebView.ResetPages();
});

$(document).on("click", ".job-page-block", function(e){
e.preventDefault();

var job = $(this).data('job');

selectedJobId = job;

if (selectedJob == null) {
$(this).addClass("job-selected");
selectedJob = this;
$(".apply-job-button").fadeIn(100);
} else if (selectedJob == this) {
$(this).removeClass("job-selected");
selectedJob = null;
$(".apply-job-button").fadeOut(100);
} else {
$(selectedJob).removeClass("job-selected");
$(this).addClass("job-selected");
selectedJob = this;
}
});

$(document).on('click', '.apply-job-button', function(e){
e.preventDefault();

$.post('https://Web-View/applyJob', JSON.stringify({
job: selectedJobId
}))

WebView.ResetPages();
});

$(document).on('click', '.back-to-main', function(e){
e.preventDefault();

$(selectedJob).removeClass("job-selected");
$(selectedIdentity).removeClass("job-selected");

WebView.ResetPages();
});
48 changes: 48 additions & 0 deletions html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css">
<link rel="stylesheet" href="./style.css">

</head>

<body>
<div class="container">
<div class="webview-main-container">

<!--
If you using custom php based webapplicaion ? like MDT system You mus copy this code block and paste to your index.php file and login.php file.
<?php
$secure = true;
$httponly = true;
$samesite = 'none';
$lifetime=600;
$maxlifetime=0;
if(PHP_VERSION_ID < 70300) {
session_set_cookie_params($maxlifetime, '/; samesite='.$samesite, $_SERVER['HTTP_HOST'], $secure, $httponly);
} else {
session_set_cookie_params([
'lifetime' => $maxlifetime,
'path' => '/',
'domain' => $_SERVER['HTTP_HOST'],
'secure' => $secure,
'httponly' => $httponly,
'samesite' => $samesite
]);
}
?>
-->

<iframe src="http://eample.com/" style="border:0px #ffffff none;" name="myiFrame" scrolling="no" frameborder="1" marginheight="0px" marginwidth="0px" height="600px" width="1077px" allowfullscreen></iframe>
</body>
<script src="./app.js"></script>
</html>
Loading

0 comments on commit fbb0226

Please sign in to comment.