[DiscordArchive] Interesting, I'll check AIO - that's an addon module right?
[DiscordArchive] Interesting, I'll check AIO - that's an addon module right?
Archived author: Honey • Posted: 2023-06-09T07:23:13.935000+00:00
Original source
That looks like it can do what you need
Archived author: ritzmenardi • Posted: 2023-06-09T07:23:30.938000+00:00
Original source
Found it, thanks!
Archived author: Foe • Posted: 2023-06-09T07:40:30.590000+00:00
Original source
Don't use CreateLuaEvent, use RegisterEvent on the player object from the OnLogin hook
Archived author: Foe • Posted: 2023-06-09T07:41:37.734000+00:00
Original source
CreateLuaEvent is a global, if you're doing it on a per player basis then RegisterEvent runs in the player context
Archived author: ritzmenardi • Posted: 2023-06-09T07:50:09.712000+00:00
Original source
I see. That makes sense. Thank you!
Archived author: ritzmenardi • Posted: 2023-06-09T08:01:00.920000+00:00
Original source
Managed to crash my server by setting the periodic events to never expire:
```lua
local function PeriodicSendMessage(eventID, delay, repeats)
-- loop through all players
for _, player in pairs(GetPlayersInWorld()) do
-- Send a chat message to the player.
player:SendBroadcastMessage("This is a periodic message!")
player:RegisterEvent(PeriodicSendMessage, 5000, 1)
end
end
local PLAYER_EVENT_ON_LOGIN = 3
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, PeriodicSendMessage)
```
note the 1 in player:RegisterEvent(PeriodicSendMessage, 5000, 1)
I had that set to 0 originally LOL