Karuzo Posted July 18, 2014 Share Posted July 18, 2014 Hey Guys, So i'm working on a downloader and i'm triggering from server to client but it always says that the event hasn't been added clientside. My Code: Client addEvent("sendModData", true) addEventHandler("sendModData", getRootElement(), function(TXDs, DFFs) outputChatBox("lol") TXDfiles = TXDs DFFfiles = DFFs checkMods() end ) Server for _, player in ipairs(getElementsByType("player")) do outputChatBox(#TXDs) outputChatBox(#DFFs) triggerClientEvent(player, "sendModData", player, TXDs, DFFs) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), loadModFiles) Meta.xml Link to comment
Et-win Posted July 18, 2014 Share Posted July 18, 2014 Probably server-side is started earlier than client-side. Maybe putting a timer on it works? Link to comment
Karuzo Posted July 18, 2014 Author Share Posted July 18, 2014 How do you mean that? And as you can see in the meta the clientside is loaded first Link to comment
Et-win Posted July 18, 2014 Share Posted July 18, 2014 It doesn't mean the client downloaded the script faster than server started the server-side script. Link to comment
12p Posted July 18, 2014 Share Posted July 18, 2014 Trigger an event from the client to the server, at the end of the client script. onClientReady or something. When the server receives it, tell it to send back an event with the data to the client. Done. Link to comment
Karuzo Posted July 18, 2014 Author Share Posted July 18, 2014 Trigger an event from the client to the server, at the end of the client script. onClientReady or something.When the server receives it, tell it to send back an event with the data to the client. Done. Yeah was that easy. Thanks. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now