local spawnedPeds = {} local peds = { { coords = vector3(438.74438476562,-987.38275146484,30.724308013916), heading = 180.39 } } AddEventHandler('onClientResourceStart', function(resourceName) if resourceName == GetCurrentResourceName() then for i=1, #peds do local blip = AddBlipForCoord(peds[i].coords.x, peds[i].coords.y, peds[i].coords.z) SetBlipSprite(blip, 545) SetBlipColour(blip, 3) SetBlipScale(blip, 0.7) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString("Driving School") EndTextCommandSetBlipName(blip) end end end) AddEventHandler('onClientResourceStop', function(resourceName) if resourceName == GetCurrentResourceName() then for i=1, #spawnedPeds do DeletePed(spawnedPeds[i].ped) end end end) local ticks = 2500 local textui = false CreateThread(function() while true do local pedPos = GetEntityCoords(PlayerPedId()) for i=1, #peds do local magazin = peds[i].coords if #(pedPos - magazin) < 25 and json.encode(spawnedPeds) == '[]' then for j=1, #peds do RequestModel('s_f_m_shop_high') while not HasModelLoaded('s_f_m_shop_high') do RequestModel('s_f_m_shop_high') Wait(0) end local ped = CreatePed(4, 's_f_m_shop_high', peds[j].coords.x, peds[j].coords.y, peds[j].coords.z, peds[j].heading, true, true) SetPedCanBeTargettedByPlayer(ped, false) SetBlockingOfNonTemporaryEvents(ped, true) SetPedAlertness(ped, 1) SetEntityCanBeDamaged(ped, false) SetEntityInvincible(ped, true) SetEntityCanBeDamaged(ped, false) FreezeEntityPosition(ped, true) table.insert(spawnedPeds, { ped = ped }) end end if #(pedPos - magazin) < 10 then ticks = 1 if #(pedPos - magazin) < 3 then if not textui then exports['vrp_textui']:Open('[E] pentru a deschide Meniul', 'darkblue', 'right') textui = true end if IsControlJustPressed(0, 38) then exports['vrp_textui']:Close() openUI() end else textui = false exports['vrp_textui']:Close() end end end Wait(ticks) end end) -- RegisterCommand("dmv", function(source, args, rawCommand) -- if PlayerPedId() and not IsPauseMenuActive() then -- openUI() -- end -- end, false) function openUI() SendNUIMessage({ type="openUI" }) SetNuiFocus(true,true) end RegisterNUICallback("NUIFocusOff",function() SendNUIMessage({ type = "closeUI" }) SetNuiFocus(false,false) end) RegisterNUICallback("sendData",function(data, cb) TriggerServerEvent("giveByData",data.correctAnswersCount) cb("ok") end)