NoviceWithManyProblems Posted January 25, 2020 Posted January 25, 2020 s.Lua: triggerClientEvent(root, "trig1", root, var1) c.Lua: outputChatBox("Test") -- good addEvent("trig1", true) addEventHandler("trig1", root, function() outputChatBox("trig111") end) meta.xml: <meta> <script src="s.Lua" type="server"/> <script src="c.Lua" type="client"/> </meta>
Moderators Patrick Posted January 25, 2020 Moderators Posted January 25, 2020 Server side load before client side. You need to wait, until client side load. outputChatBox("Test") -- good addEvent("trig1", true) addEventHandler("trig1", root, function() outputChatBox("trig111") end) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientSideStarted", resourceRoot) end) addEvent("onClientSideStarted", true) addEventHandler("onClientSideStarted", resourceRoot, function() triggerClientEvent(root, "trig1", root, var1) end)
NoviceWithManyProblems Posted January 25, 2020 Author Posted January 25, 2020 6 minutes ago, stPatrick said: Server side load before client side. You need to wait, until client side load. outputChatBox("Test") -- good addEvent("trig1", true) addEventHandler("trig1", root, function() outputChatBox("trig111") end) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientSideStarted", resourceRoot) end) addEvent("onClientSideStarted", true) addEventHandler("onClientSideStarted", resourceRoot, function() triggerClientEvent(root, "trig1", root, var1) end) is now being sent, but the error is still showing up and I want it to be without error in db3
Moderators Patrick Posted January 25, 2020 Moderators Posted January 25, 2020 6 minutes ago, NoviceWithManyProblems said: is now being sent, but the error is still showing up and I want it to be without error in db3 Something else is doing it.
Moderators IIYAMA Posted January 25, 2020 Moderators Posted January 25, 2020 28 minutes ago, NoviceWithManyProblems said: is now being sent, but the error is still showing up and I want it to be without error in db3 That is because it is also send to players that didn't load the resource. Instead, send it right back to the sender: client addEvent("onClientSideStarted", true) addEventHandler("onClientSideStarted", resourceRoot, function() triggerClientEvent(client, "trig1", root, var1) end) See also this tutorial/enchantment, it does error handling for you as well as providing things like callbacks: 2
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