mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Del(sv_main): Removed old file and cleaned up new
This commit is contained in:
1 parent
3b7a5357c7
commit
8a2a213715
2 files changed
-102
No files matched your search
@@ -1,70 +0,0 @@
|
|||||||
ESX = nil
|
|
||||||
db = DatabaseConfig -- helper variable for use in server functions
|
|
||||||
|
|
||||||
TriggerEvent('esx:getSharedObject', function(obj)
|
|
||||||
ESX = obj
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
-- we pass the server configuration to the phone so that we can have phone or
|
|
||||||
-- app specific settings configured by the server owner
|
|
||||||
ESX.RegisterServerCallback('phone:phoneConfig', function(source, cb)
|
|
||||||
cb(Config)
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
RegisterServerEvent('phone:getCredentials')
|
|
||||||
AddEventHandler('phone:getCredentials', function()
|
|
||||||
local _source = source
|
|
||||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
|
||||||
local _identifier = xPlayer.getIdentifier()
|
|
||||||
MySQL.Async.fetchAll('SELECT ' .. db.users.phoneNumber .. ' AS phone_number FROM ' .. db.users.table .. ' WHERE ' .. db.users.id .. '=@identifier',
|
|
||||||
{
|
|
||||||
['@identifier'] = _identifier
|
|
||||||
},
|
|
||||||
function(result)
|
|
||||||
for k,v in pairs(result) do
|
|
||||||
print(v.phone_number)
|
|
||||||
number = v.phone_number
|
|
||||||
end
|
|
||||||
TriggerClientEvent('phone:sendCredentials', _source, number)
|
|
||||||
end)
|
|
||||||
TriggerClientEvent('phone:send', _source)
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterCommand('getnumber', function(source, args)
|
|
||||||
local _source = source
|
|
||||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
|
||||||
local _identifier = xPlayer.getIdentifier()
|
|
||||||
print(_identifier)
|
|
||||||
end)
|
|
||||||
|
|
||||||
ESX.RegisterServerCallback('phone:getItemAmount', function(source, cb, item)
|
|
||||||
local xPlayer = ESX.GetPlayerFromId(source)
|
|
||||||
local items = xPlayer.getInventoryItem(item)
|
|
||||||
|
|
||||||
if items == nil then
|
|
||||||
cb(0)
|
|
||||||
else
|
|
||||||
cb(items.count)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
----
|
|
||||||
--Destroy Phone
|
|
||||||
--
|
|
||||||
|
|
||||||
ESX.RegisterServerCallback('phone:removephone', function(source, cb, item)
|
|
||||||
local xPlayer = ESX.GetPlayerFromId(source)
|
|
||||||
local items = xPlayer.getInventoryItem(item)
|
|
||||||
|
|
||||||
if items == nil then
|
|
||||||
cb(0)
|
|
||||||
else
|
|
||||||
cb(items.count)
|
|
||||||
if items.count > 0 then
|
|
||||||
xPlayer.removeInventoryItem('phone', items.count)
|
|
||||||
xPlayer.addInventoryItem('dphone', items.count)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
@@ -32,35 +32,3 @@ onNet('phone:getCredentials', async () => {
|
|||||||
console.log('Failed to get number. ', error);
|
console.log('Failed to get number. ', error);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
//ESX.RegisterServerCallback('phone:getItemAmount', function(source, cb, item)
|
|
||||||
// local xPlayer = ESX.GetPlayerFromId(source)
|
|
||||||
// local items = xPlayer.getInventoryItem(item)
|
|
||||||
//
|
|
||||||
// if items == nil then
|
|
||||||
// cb(0)
|
|
||||||
// else
|
|
||||||
// cb(items.count)
|
|
||||||
// end
|
|
||||||
//end)
|
|
||||||
//
|
|
||||||
//----
|
|
||||||
//--Destroy Phone
|
|
||||||
//--
|
|
||||||
//
|
|
||||||
//ESX.RegisterServerCallback('phone:removephone', function(source, cb, item)
|
|
||||||
// local xPlayer = ESX.GetPlayerFromId(source)
|
|
||||||
// local items = xPlayer.getInventoryItem(item)
|
|
||||||
//
|
|
||||||
// if items == nil then
|
|
||||||
// cb(0)
|
|
||||||
// else
|
|
||||||
// cb(items.count)
|
|
||||||
// if items.count > 0 then
|
|
||||||
// xPlayer.removeInventoryItem('phone', items.count)
|
|
||||||
// xPlayer.addInventoryItem('dphone', items.count)
|
|
||||||
// end
|
|
||||||
// end
|
|
||||||
//end)
|
|
||||||
Reference in new issue
Block a user