Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------
- -- Header / Prework --
- ----------------------
- ESX = nil
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- ------------------------
- -- Usage and Provides --
- ------------------------
- -- This script provides the following Commands in-game:
- -- /invoiceid <PlayerID> <Amount>
- -- /seizeid <PlayerID> <Amount>
- -- /invoiceplayer <Amount>
- --
- -- /invoiceplayer is proximity based, so you have to be very careful when using it.
- --------------------------
- -- Todo for this script --
- --------------------------
- -- Ensure that the Player doesn't fine themselves
- -- Ensure that in all instances where the user inputs an ID, that person exists
- ----------
- -- Main --
- ----------
- -- /invoiceid <PlayerID> <Amount>
- RegisterCommand('invoiceid', function(source, args)
- local src = source
- -- Get our fine amount from the parameter inputs
- local amount = tonumber(args[2])
- local playerID = tonumber(args[1])
- local verbose = args[3]
- local xGiver = ESX.GetPlayerFromId(src)
- local xPlayer = ESX.GetPlayerFromId(playerID)
- -- --
- -- Debugging section to print out all values --
- -- --
- if verbose == 'debug' then
- print("Debug amount: " .. amount)
- print("Debug PlayerID: " .. playerID)
- print("Debug src: " .. src)
- print("Debug xPlayer: " .. inspect(xPlayer))
- print("Debug playerID (getPlayerFromServerID): " .. ESX.GetPlayerFromServerId(playerID))
- print("Debug playerID (GetPlayerServerId): " .. ESX.GetPlayerServerId(playerID))
- print("Debug xPlayer (getPlayerFromServerID): " .. ESX.GetPlayerFromServerId(xPlayer))
- print("Debug xPlayer (GetPlayerServerId): " .. ESX.GetPlayerServerId(xPlayer))
- end
- -- Let's make sure the person running /fineid is a police officer
- -- Debug: Trying GetPlayerFromServerId, GetPlayerServerId, getPlayerID
- if xGiver.job.name == 'police' then
- if amount ~= nil then
- TriggerClientEvent('mythic_notify:client:SendAlert', src, { type = 'inform', text = 'You have fined ID - [' .. playerID .. '] for $' .. amount .. '.' })
- TriggerClientEvent('mythic_notify:client:SendAlert', playerID, { type = 'inform', text = 'You have been sent a Fine for $' .. amount .. '.'})
- TriggerClientEvent('prp-fineid:Anim', src)
- TriggerServerEvent('esx_billing:sendBill', playerID, 'society_police', 'Police Fine', amount)
- end
- end
- end)
- -- /seizeid <PlayerID> <Amount>
- -- (Takes directly from the player bank!)
- RegisterCommand('seizeid', function(source, args)
- local src = source
- -- Get our fine amount from the parameter inputs
- local amount = tonumber(args[2])
- local playerID = tonumber(args[1])
- local verbose = args[3]
- local xGiver = ESX.GetPlayerFromId(src)
- local xPlayer = ESX.GetPlayerFromId(playerID)
- -- --
- -- Debugging section to print out all values --
- -- --
- if verbose == 'debug' then
- print("Debug amount: " .. amount)
- print("Debug PlayerID: " .. playerID)
- print("Debug src: " .. src)
- end
- -- Let's make sure the person running /fineid is a police officer
- if xGiver.job.name == 'police' then
- if amount ~= nil then
- TriggerClientEvent('mythic_notify:client:SendAlert', src, { type = 'inform', text = 'You have seized ID - [' .. playerID .. '] for $' .. amount .. '.' })
- TriggerClientEvent('mythic_notify:client:SendAlert', playerID, { type = 'inform', text = 'Your money has been seized by the DOJ: $' .. amount .. '.'})
- TriggerClientEvent('prp-fineid:Anim', src)
- xPlayer.removeAccountMoney('bank', amount)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement