mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
Feat(Client/Server): Fetching phone number | Some fixes in JS monkaS
This commit is contained in:
1 parent
5bdfaca89f
commit
e4c592d774
7 files changed
+106
-24
No files matched your search
@@ -0,0 +1,18 @@
|
||||
fx_version "adamant"
|
||||
game "gta5"
|
||||
|
||||
client_script {
|
||||
'resources/client/cl_main.lua'
|
||||
}
|
||||
|
||||
server_script {
|
||||
"@mysql-async/lib/MySQL.lua",
|
||||
'resources/server/sv_main.lua'
|
||||
}
|
||||
|
||||
ui_page 'resources/html/index.html'
|
||||
|
||||
files {
|
||||
'resources/html/index.html',
|
||||
'resources/html/main.js'
|
||||
}
|
||||
+11
-23
@@ -30,29 +30,17 @@ setTimeout(() => {
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent("message", {
|
||||
data: {
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
data: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new MessageEvent("message", {
|
||||
data: {
|
||||
app: "PHONE",
|
||||
method: "setPowerOff",
|
||||
data: false,
|
||||
},
|
||||
})
|
||||
);
|
||||
}, 2300);
|
||||
//setTimeout(() => {
|
||||
// window.dispatchEvent(
|
||||
// new MessageEvent("message", {
|
||||
// data: {
|
||||
// app: "PHONE",
|
||||
// method: "setVisibility",
|
||||
// data: true,
|
||||
// },
|
||||
// })
|
||||
// );
|
||||
//}, 1000);
|
||||
|
||||
function Phone() {
|
||||
useNuiService();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { Button } from "../../../ui/components/Button";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useBank } from "../hooks/useBank";
|
||||
import { TransactionList } from "./TransactionList";
|
||||
import { TransactionList } from "./transactionList";
|
||||
import "./BankApp.css";
|
||||
import { useApp } from "../../../os/apps/hooks/useApps";
|
||||
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,2 @@
|
||||
import { atom, selector, useRecoilState } from "recoil";
|
||||
import { useNuiEvent } from "../../os/nui-events/hooks";
|
||||
@@ -0,0 +1,47 @@
|
||||
ESX = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
|
||||
--RegisterCommand('phone:get', function(source, args, rawCommand)
|
||||
-- TriggerServerEvent('phone:server:getCredentials')
|
||||
--end, false)
|
||||
|
||||
RegisterCommand('phone:open', function(source, args, rawCommand)
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = 'PHONE',
|
||||
method = 'setVisibility',
|
||||
data = true
|
||||
}
|
||||
)
|
||||
SetNuiFocus(true, true)
|
||||
end, false)
|
||||
|
||||
|
||||
RegisterCommand('phone:hide', function(source, args, rawCommand)
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = 'PHONE',
|
||||
method = 'setVisibility',
|
||||
data = false
|
||||
}
|
||||
)
|
||||
SetNuiFocus(false, false)
|
||||
end, false)
|
||||
|
||||
RegisterNetEvent('phone:client:sendCredentials')
|
||||
AddEventHandler('phone:client:sendCredentials', function(number)
|
||||
print("My number is " .. number)
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = "SIMCARD",
|
||||
method = "setNumber",
|
||||
data = number
|
||||
}
|
||||
)
|
||||
end)
|
||||
@@ -0,0 +1,27 @@
|
||||
ESX = nil
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj)
|
||||
ESX = obj
|
||||
end)
|
||||
|
||||
--RegisterCommand('server_getnumber', function(source, args, rawCommand)
|
||||
-- TriggerEvent('phone:server:getCredentials', source)
|
||||
--end, false)
|
||||
|
||||
RegisterServerEvent('phone:server:getCredentials')
|
||||
AddEventHandler('phone:server:getCredentials', function(source)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local _identifier = xPlayer.getIdentifier()
|
||||
MySQL.Async.fetchAll('SELECT phone_number FROM users WHERE `identifier`=@identifier',
|
||||
{
|
||||
['@identifier'] = _identifier
|
||||
},
|
||||
function(result)
|
||||
for k,v in pairs(result) do
|
||||
print(v.phone_number)
|
||||
local number = v.phone_number
|
||||
TriggerClientEvent('phone:client:sendCredentials', _source, number)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
Reference in new issue
Block a user