Fire is only client side. How would I make server sided fire?

cause im really stuck

I don’t understand where you’re stuck

Whenever i try to sync i either get errors or it straight up doesnt work. Could you make a sort of template where i can simply add the startscriptfire?

Ohh I haven’t enough time to do this.
If your piece of code is working for 1 person, it should work for everyone :slight_smile:

Would i need a server lua and client lua

Yes you would need both.

What you have to do is, is something like this:

clientsided (client.lua)

Citizen.CreateThread(function() --This triggers a Server Event, when you press the specified Key
	while true do
		Citizen.Wait(0)
		if IsControlJustReleased(1, 167) then
			TriggerServerEvent("FIRE", PlayerId())
		end
	end
end)

.
Now we take a look at the Server, where the Event gets triggered
serversided (server.lua)

RegisterServerEvent("FIRE") --This registers the Server Event, so the client can trigger it

AddEventHandler("FIRE", function(player) --This is the actual Event
	TriggerClientEvent("FireForAll", -1, player) --This triggers a Event on every client, so the fire is visible for everyone.
end)

.
Back to Client
clientsided (client.lua)

RegisterNetEvent("FireForAll") --This registers the Client Event, so the server can trigger it
AddEventHandler("FireForAll", function(player) --This is the actual Event
	local playerPos = GetEntityCoords(GetPlayerPed(player))
	StartScriptFire (playerPos.x, playerPos.y, playerPos.z, 25, false)
end)

Please, don’t just copy and paste, try to understand it and create something on your own. It is much more fun, if you understand what you are doing and how it works.

EDIT:
Fixed the issue

slight issue however, it spawns the fire at everyones location. Is it possible to do it at the location of the person who pressed it?

There’s an error for this. It doesn’t show the fire at my location to everyoen, it spawns a fire to everyone’s location

@sadboilogan @LewisOSFDev

Try again, I hopefully fixed it ^^

But it is like I said, next time, try it at your own!

One more thing, How would i go about stopping a looped fire script?

https://runtime.fivem.net/doc/reference.html#_0x7FF548385680673F

What do I edit to make sure it doesn’t spawn on you and kill you? lol

I think you can check position before spawn the fire

If you want it on you you can put like eg playerPos.x-5

If you want to discuss you getting my alpha version of a 95% working fire script then pm me