should it be called in the loop?
According to my tests yes it is necessary after I am not a professional I could be mistaken in my code so simply it takes 1 min to try it out of the loop it’s only a native try it from your side.
Thank you!
nice work but i have the problem that i can no one helmet anymore at clotheshop i need a solution that allow own helemts
Did You Fix IT ?
Citizen.CreateThread( function()
while true do
REVEL = 1000
if IsPedInAnyVehicle(PlayerPedId(), false) then
REVEL = 1
SetPedConfigFlag(PlayerPedId(), 35, false)
end
Citizen.Wait(REVEL)
end
end)
this one its better otimizated the loop will only repeat 1 ms when only the ped is on the vehicle … else will 1000 ms
Made one that does not use a looping function instead it will use a player spawned function! works ESX V1 final. Not fancy code pretty basic but it works!
works flawlessly nice job!
works perfect thank you so much reveldev
no problem <3
hi normal i have the animation ?
I made this and it works fine :
AddEventHandler(“esx:onPlayerSpawn”, function()
Citizen.CreateThread(function()
local playerPed = PlayerPedId()
local wait = 1000
while true do
if IsPedOnAnyBike(playerPed) then
wait = 1
SetPedConfigFlag(playerPed, 35, false)
end
Citizen.Wait(wait)
end
end)
end)
I tested every script thats listed in this chat but it doesnt work… He still puts his helmet on…
This is a QBCORE whitout any loop and working perfectly
Client side:
local poner = true
RegisterNetEvent(“jojutom:client:nocasco”)
AddEventHandler(“jojutom:client:nocasco”, function(contra)
if contra == 7283 then
if poner then
poner = false
QBCore.Functions.Notify(“Ahora no te pondrás el casco.”)
SetPedHelmet(PlayerPedId(), false)
else
poner = true
QBCore.Functions.Notify(“Ahora te pondrás el casco.”)
SetPedHelmet(PlayerPedId(), true)
end
else
your ban event
end
end)
Server side
QBCore.Commands.Add(‘cascomoto’, ‘Modificar si te pones el casco o no en una moto’, {}, false, function(source)
TriggerClientEvent(“joju:client:nocasco”, source, 7283)
end)
Thank you
first script, wich works for me. love it.
can you tell me, why flags works better than peds?
– no need
–local firstSpawn = true
local PlayerLoaded = false
ESX = exports[“es_extended”]:getSharedObject()
RegisterNetEvent(‘esx:playerLoaded’)
AddEventHandler(‘esx:playerLoaded’, function(xPlayer)
ESX.PlayerData = xPlayer
PlayerLoaded = true
end)
– No need
–[[RegisterNetEvent(‘esx:setJob’)
AddEventHandler(‘esx:setJob’, function(job)
ESX.PlayerData.job = job
end)]]
RegisterNetEvent(‘esx:playerSpawned’)
AddEventHandler(‘playerSpawned’, function(spawn)
SetPedHelmet(GetPlayerPed(-1), false)
end)
–Adaptation of getSharedObject for ESX Legacy
So Event setJob is not utile the same of local firstspawn because where in the script we use this local ?
Really?
This code is the same ↓↓↓↓
ESX = exports[“es_extended”]:getSharedObject()
local PlayerLoaded = false
local playerPed = PlayerPedId()
RegisterNetEvent(‘esx:playerLoaded’)
AddEventHandler(‘esx:playerLoaded’, function(xPlayer)
ESX.PlayerData = xPlayer
PlayerLoaded = true
end)
RegisterNetEvent(‘esx:playerSpawned’)
AddEventHandler(‘playerSpawned’, function(spawn)
if IsPedOnAnyBike(playerPed) then
SetPedHelmet(GetPlayerPed(-1), false)
end
end)
And add that > if IsPedOnAnyBike(playerPed) then
This is the correct one, it doesn’t make the animation and it doesn’t put the helmet on, it works for esx and qbcore