[HELP] Client Resource Not Working


#1

Hi All,

I have a client resource that I need to work but it doesn’t seem to like it.

Could you have a look for me.

Obviously the resource is starting but nothing seems to run.

local ped = GetPlayerPed(-1)
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local nveh = CreateVehicle(mhash, x,y,z+0.5, 0.0, true, false)

Citizen.CreateThread(function()
    while true do
		
        HideHudComponentThisFrame(1)
        HideHudComponentThisFrame(2)
        HideHudComponentThisFrame(3)
        HideHudComponentThisFrame(4)
        HideHudComponentThisFrame(6)
        HideHudComponentThisFrame(7)
        HideHudComponentThisFrame(8)
        HideHudComponentThisFrame(9)
        HideHudComponentThisFrame(13)
        HideHudComponentThisFrame(14)
        HideHudComponentThisFrame(17)
        HideHudComponentThisFrame(20)
        SetVehicleDensityMultiplierThisFrame(0.6)
		SetPedDensityMultiplierThisFrame(0.6)
		SetRandomVehicleDensityMultiplierThisFrame(0.6)
		SetParkedVehicleDensityMultiplierThisFrame(0.6)
		SetScenarioPedDensityMultiplierThisFrame(0.6, 0.6)
        SetPlayerWantedLevel(PlayerId(), 0, false)
        SetPlayerWantedLevelNow(PlayerId(), false)
	end

end)
AddEventHandler('playerSpawned', function(spawn)
	Citizen.Wait(0)
	SetNotificationTextEntry("STRING")
	AddTextComponentString("~b~Welcome to [FiveM] Winter Roleplay.~n~<b>~h~~r~Please read the rules.</b>~n~~w~Discord: https://discord.gg/9Nk2PYh") 
	DrawNotification(true, false) 
end)

Thanks in Advance!

Harry


#2

bump

20 characters x


#3

Hi,

I see some problems.

First, I don’t understant what you trying to do on the top:

local ped = GetPlayerPed(-1)
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local nveh = CreateVehicle(mhash, x,y,z+0.5, 0.0, true, false)

“ped” and “vehicle” are never used, so, why are there here? Then, you create a vehicle, but where did you declare “mhash”, “x”, “y” and “z”?

Second problem, in your while loop, there is no wait. Important rule, never use a “while true” without Citizen.Wait. Just add this:

Citizen.Wait(0)