TriggerClientEvent("cooldownt")
Hi,
You can simply use the event "baseevents:onPlayerDied"
then start the cooldown, no need to create a new thread
where do I post this event?
the event is from baseevent
resource, just listen for it.
AddEventHandler(“baseevents:onPlayerDied”, function()
TriggerEvent("cooldownt")
end)
I put this in Server.lua and give me error in console ;(
AddEventHandler(“baseevents:onPlayerDied”, function()
TriggerClientEvent(“cooldownt”, -1)
end)
if I remove the -1 from the code does not give me error in the console but the countdown does not start!
No, use it on client side.
And I forgot to tell you, there’s 2 events, "baseevents:onPlayerDied"
and "baseevents:onPlayerKilled"
, the second one is when the player is killed by someone, the first one is other case.
ok, now I test and update you, thank you very much
I tried both with these codes in Server.lua
AddEventHandler(“baseevents:onPlayerKilled”, function()
TriggerEvent(“cooldownt”, -1)
end)AddEventHandler(“baseevents:onPlayerDied”, function()
TriggerEvent(“cooldownt”, -1)
end)
or so, but do not even count the countdown
AddEventHandler(“onPlayerKilled”, function()
TriggerEvent(“cooldownt”, -1)
end)AddEventHandler(“onPlayerDied”, function()
TriggerEvent(“cooldownt”, -1)
end)
there are no errors in the console
As I said, in your client.lua
I tried as well in client.lua
So, maybe a problem with copy/paste of “, because it’s different than "
Should be good:
AddEventHandler("baseevents:onPlayerKilled", function()
TriggerEvent("cooldownt")
end)
AddEventHandler("baseevents:onPlayerDied", function()
TriggerEvent("cooldownt")
end)
Then, is baseevents
started in your server.cfg
?
Which is?
Then, is
baseevents
started in yourserver.cfg
?
i use FX-Server
Huh?
When I ask :
That’s to know if there’s start baseevents
somewhere in your server.cfg
file
It works, thank you very much, I have another problem I want it to draw only the start only to a player the cooldown and not to the whole server, how do I do it?
TriggerEvent(“cooldownt”, -1)
-1 = All Players
In your RegisterCommand
, you have access to source, to know who execute the command. Just need to replace -1
by source
, so:
RegisterCommand("cw", function(source, args, raw)
TriggerClientEvent("cooldownt", source)
end, false)
maybe I have to remove a parenthesis