Lua:
RegisterNetEvent('vihkohomma')
AddEventHandler('vihkohomma', function()
if not IsAnimated then
local prop_name = 'PROP_PENCIL_01'
local prop_name2 = 'PROP_NOTEPAD_02'
IsAnimated = true
local playerPed = GetPlayerPed(-1)
Citizen.CreateThread(function()
local x,y,z = table.unpack(GetEntityCoords(playerPed))
prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true)
prop2 = CreateObject(GetHashKey(prop_name2), x, y, z+0.2, true, true, true)
AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.09, 0.01, -0.05, 90.0, 150.0, 200.0, true, true, false, true, 1, true)
AttachEntityToEntity(prop2, playerPed, GetPedBoneIndex(playerPed, 60309), -0.00, 0.00, 0.03, 193.0, 150.0, 200.0, true, true, false, true, 1, true)
RequestAnimDict("amb@medic@standing@timeofdeath@base")
while not HasAnimDictLoaded("amb@medic@standing@timeofdeath@base") do
Citizen.Wait(0)
end
TaskPlayAnim(GetPlayerPed(-1), "amb@medic@standing@timeofdeath@base", "base", 8.0, -8, -1, 55, 0, 0, 0, 0)
Citizen.Wait(2000)
while not IsControlPressed(0, 73) do
if not IsEntityPlayingAnim(GetPlayerPed(-1), "amb@medic@standing@timeofdeath@base", "base", 3) then
break
end
Wait(5)
end
IsAnimated = false
StopAnimPlayback(GetPlayerPed(-1), 0, true)
DeleteObject(prop)
DeleteObject(prop2)
end)
end
Esimerkki esx_mechanicjobista
Lua:
if data.current.value == 'billing' then
TriggerEvent('vihkohomma')
ESX.UI.Menu.Open(
'dialog', GetCurrentResourceName(), 'billing',
{
title = ('Laskun määrä')
},
function(data, menu)
local amount = tonumber(data.value)
if amount == nil or amount < 0 then
ESX.ShowNotification('Tarkista ~r~määrä')
else
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification('~r~Ei~w~ pelaajaa lähistöllä')
else
menu.close()
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mafia', ('Bennys'), amount)
ESX.ShowNotification('Lähetetty')
end
end
end,
function(data, menu)
menu.close()
end
)
end