vRP edit
__resource.lua
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
dependency "vrp"
client_scripts {
'hospital_cl.lua'
}
server_scripts {
'@vrp/lib/utils.lua',
'hospital_sv.lua'
}
svr
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP", "vRP_heal")
RegisterServerEvent("hospital:price")
AddEventHandler("hospital:price", function()
local user_id = vRP.getUserId({source})
local player = vRP.getUserSource({user_id})
if vRP.tryFullPayment({user_id, 1000}) then
else
vRPclient.notify(player, {"~r~BradXY Care Approved -$0."})
end
end)
cl
---------- VARIABLES ----------
local treatment = false
local timer = false
local blips = {
{name="Hospital", id=80, x= 338.85, y= -1394.56, z= 31.51, color= 1},
{name="Hospital", id=80, x= -449.67, y= -340.83, z= 33.50, color= 1},
{name="Hospital", id=80, x= 298.40, y= -584.15, z= 42.26, color= 1},
{name="Hospital", id=80, x= 1827.97, y= 3692.58, z= 33.22, color= 1},
{name="Hospital", id=80, x= -239.89, y= 6323.59, z= 31.42, color= 1},
}
---------- FONCTIONS ----------
function Notify(text)
SetNotificationTextEntry('STRING')
AddTextComponentString(text)
DrawNotification(false, false)
end
function ShowInfo(text, state)
SetTextComponentFormat("STRING")
AddTextComponentString(text)DisplayHelpTextFromStringLabel(0, state, 0, -1)
end
function ConfigLang(lang)
local lang = lang
if lang == "FR" then
lang_string = {
text1 = "Appuyer sur ~INPUT_VEH_HORN~ pour être soigné ~r~(~h~~g~500$~r~)",
text2 = "Le ~h~~g~docteur ~s~va te ~h~~r~soigner~s~, ~h~~b~soit patient~s~.",
text3 = "Tu n'as pas besoin d'être ~h~~r~soigner~s~.",
text4 = "Tu as été ~h~~r~soigné~s~.",
text5 = "Tu as ~h~~r~bougé~s~, le ~h~~g~docteur~s~ n'as pas pu te ~h~~r~soigner~s~ !",
}
elseif lang == "EN" then
lang_string = {
text1 = "Press ~INPUT_VEH_FLY_VERTICAL_FLIGHT_MODE~ to be healed ~r~(~h~~g~$1,000~r~)",
text2 = "The ~h~~g~doctor ~s~is ~h~~r~healing~s~ you, ~h~~b~please wait~s~.",
text3 = "You don't need ~h~~r~healing~s~.",
text4 = "~h~~r~All~s~ ~h~~g~Healed",
text5 = "~h~You have ~h~~r~moved away~s~, the ~h~~g~doctor~s~ could not ~h~~r~heal~s~ you !",
}
end
end
---------- CITIZEN ----------
Citizen.CreateThread(function()
for _, item in pairs(blips) do
item.blip = AddBlipForCoord(item.x, item.y, item.z)
SetBlipSprite(item.blip, item.id)
SetBlipColour(item.blip, item.color)
SetBlipAsShortRange(item.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(item.name)
EndTextCommandSetBlipName(item.blip)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
for _, item in pairs(blips) do
if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), item.x, item.y, item.z, true) <= 20 then
DrawMarker(0, item.x, item.y, item.z, 0, 0, 0, 0, 0, 0, 2.001, 2.0001, 0.5001, 0, 155, 255, 200, 0, 0, 0, 0)
if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), item.x,item.y,item.z, true) <= 2 then
ShowInfo(lang_string.text1, 0)
if (IsControlJustPressed(1,119)) and (GetEntityHealth(GetPlayerPed(-1)) < 200) and (GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), item.x, item.y, item.z, true) <= 2) then
Notify(lang_string.text2)
treatment = true
end
end
end
if (IsControlJustPressed(1,119)) and (GetEntityHealth(GetPlayerPed(-1)) == 200) and (GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), item.x, item.y, item.z, true) <= 2) then
Notify(lang_string.text3)
end
if treatment == true then
Citizen.Wait(5000)
timer = true
end
if treatment == true and timer == true and (GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), item.x, item.y, item.z, true) <= 2) then
TriggerServerEvent('hospital:price')
SetEntityHealth(GetPlayerPed(-1), 200)
Notify(lang_string.text4)
treatment = false
timer = false
end
if treatment == true and timer == true and (GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), item.x, item.y, item.z, true) > 2) then
Notify(lang_string.text5)
treatment = false
timer = false
end
end
end
end)
Citizen.CreateThread(function()
RequestModel(GetHashKey("s_m_m_doctor_01"))
while not HasModelLoaded(GetHashKey("s_m_m_doctor_01")) do
Wait(1)
end
local hospitalped = CreatePed(4, 0xd47303ac, 338.85, -1394.56, 31.51, 49.404, false, true)
SetEntityHeading(hospitalped, 49.404)
FreezeEntityPosition(hospitalped, true)
SetEntityInvincible(hospitalped, true)
SetBlockingOfNonTemporaryEvents(hospitalped, true)
end)
AddEventHandler("playerSpawned", function()
local lang = "EN"
ConfigLang(lang)
end)