[dev] car boost with cooldown


#1

This is for people who want to build a turbo like thing for their server, this will work on any server, all you have to do is create a client.lua file and make it a resource, paste this and get it going.

local nitroUsado = false

Citizen.CreateThread(function()
while true do
	Citizen.Wait(1)
		if IsPedInAnyVehicle(ped, false) then
			if IsControlJustPressed(0, 38) then
			SetVehicleBoostActive(veh, true)
			Citizen.Trace("En 3 segundos se acabará el turbo")
			Citizen.Wait(3000)
			nitroUsado = true
			SetVehicleBoostActive(veh, false)
			end
		end
	end
end)

Citizen.CreateThread(function()
while true do
	Citizen.Wait(1)
		if nitroUsado then
			Citizen.Wait(60000)
		nitroUsado = false
		end
	end
end)

#2

la jente no lo tiene que comprar?


#3

No, no necesitas comprar


#4

es facil par aserlo para que ocupen de comprarlo?


#5

really wanna add this but i want to make it a purchasable item. kinda like his ESX version.


#6

No se les permite vender cosas en los foros aquí. Está en contra de las reglas.


#7

This is a english forum.


#8

I know, i am just helping him out.


#9

Yeah man thats totally understandable :stuck_out_tongue:

Para (for) @GeorgeRios :

English:
Next time, use https://translate.google.com/ to be able to communicate in English in the forums. Have fun here!

Spanish:
La próxima vez, use https://translate.google.com/ para poder comunicarse en inglés en los foros. Diviértete aquí!


#10

ummmm i dont know what made you think i wanna sell this to someone. Im asking is it possible to make an item in a store so that this script can check and they will use the turbo. . . . . .


#11

only reason i asked in spanish is because the script is in spanish…


#12

Yeah that’s understandable. But pertaining to your question are you asking if you can buy it in a store in game?


#13

have you seen the esx version of this script? if not, The esx version of this script you need to purchase the turbo from a store and you can only use the turbo/nitrous if they have that item in their inventory.


#14

Yeah thats what I thought :smile:

Well for that I would ask under the ESX Shops topic; Maybe they can help you better as I don’t even think that guy understood your question but that is what I recommend you do. Goodluck!


#15

hyper9xa is actually the creater of the esx version of this script so i was actually asking him. thanks for the help though ill just try to add it so it checks your inventory.


#16

Oh I didn’t realize that :joy:

Well yeah man goodluck :stuck_out_tongue:


#19

If I’m understanding the native correctly (https://runtime.fivem.net/doc/reference.html#_0x4A04DE7CAB2739A1), this only gives the sound effect as opposed to an actual boost (unless that’s the intention of the script), and secondly, your ‘veh’ is undefined, doesn’t it need to be:

local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)

And same with your ped

Just my 2 cents

yo soy estudiante de español


#20

Yeah, it’s so because I am spanish.

It’s easy to do as long as you know how to implement but it depends on which base.

I have made it for ESX and it’s item based, check it out.

I will check later to see if this is the correct one that I wanted to use, not sure since I don’t have FiveM installed to play now, I just code and hope it works.