Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. ESX = nil
  2.  
  3. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  4.  
  5. -- Todo for this script:
  6. --
  7. -- 1. Barf if use does not put in arguments instead of thowing a script error
  8. -- 2. Make sure the user doesn't invoice/fine themselves
  9. --
  10.  
  11. -- /invoiceid invoices a player for the amount specified.
  12. RegisterCommand('invoiceid', function(source, args)
  13.  
  14.     local src = source
  15.  
  16.     -- Get our fine amount from the parameter inputs
  17.     local amount   = tonumber(args[2])
  18.     local playerID = tonumber(args[1])
  19.     local verbose  = args[3]
  20.     local xGiver   = ESX.GetPlayerFromId(src)
  21.     local xPlayer  = ESX.GetPlayerFromId(playerID)
  22.  
  23.    
  24.    --                                              --
  25.    -- Debugging section to print out all values    --
  26.    --                                              --
  27.     if verbose == 'debug' then
  28.       print("Debug amount: "           .. amount)
  29.       print("Debug PlayerID: "         .. playerID)
  30.       print("Debug src: "              .. src)
  31.     end
  32.  
  33.     -- Let's make sure the person running /fineid is a police officer
  34.     if xGiver.job.name == 'police' then
  35.         if amount ~= nil then
  36.             TriggerClientEvent('mythic_notify:client:SendAlert', src,     { type = 'inform', text = 'You have fined ID - [' .. playerID .. '] for $' .. amount .. '.' })
  37.             TriggerClientEvent('mythic_notify:client:SendAlert', playerID, { type = 'inform', text = 'You have been sent a Fine for $' .. amount .. '.'})
  38.             TriggerClientEvent('prp-fineid:Anim', src)
  39.             TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(xPlayer), 'society_police', 'Police Fine', amount)
  40.         end
  41.     end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement