Serpens Posted September 23, 2016 Share Posted September 23, 2016 (edited) I know this is a beginner question, but since I saw literally hundred different ways it is done in several mods, I'm very confused at the moment =/ If I want code NOT executed for clients (cause they are missing the components), what do I write? In the ShowMe mod I saw this code:local CLIENT_SIDE = _G.TheNet:GetIsClient() or (TheNet:GetIsServer() and not TheNet:IsDedicated()) In Iceflingomatic behaviour I saw:if GLOBAL.TheNet:GetIsServer() or GLOBAL.TheNet:IsDedicated() then Other mods only use GLOBAL.TheNet:GetIsServer. I made a mod that just increases range/damage of explosive things like gunpowder. My code was: if not (GLOBAL.TheNet:GetIsServer() or GLOBAL.TheNet:IsDedicated()) then return end AddPrefabPostInit("gunpowder", function(inst) inst.components.explosive.explosiverange = inst.components.explosive.explosiverange + GetModConfigData("gunpowderrange") inst.components.explosive.explosivedamage = inst.components.explosive.explosivedamage + GetModConfigData("gunpowderdamage") end) AddPrefabPostInit("slurtleslime", function(inst) inst.components.explosive.explosiverange = inst.components.explosive.explosiverange + GetModConfigData("slurtleslimerange") inst.components.explosive.explosivedamage = inst.components.explosive.explosivedamage + GetModConfigData("slurtleslimedamage") end) But still someone got a crash, because of the missing "explosive" component. So I wonder how this is possible?! Is it the Dedicated stuff that I should remove? But if this is causing the trouble, why do other mods use this? Edited September 23, 2016 by Serpens Link to comment https://forums.kleientertainment.com/forums/topic/70377-how-to-get-if-user-is-client-or-not/ Share on other sites More sharing options...
DarkXero Posted September 24, 2016 Share Posted September 24, 2016 It should work. I saw the error image. http://i.imgur.com/jjxIOry.jpg The error is on line 2. Doesn't add up. You sure you didn't have a all_clients_require_mod = true and no server check for your first version? Link to comment https://forums.kleientertainment.com/forums/topic/70377-how-to-get-if-user-is-client-or-not/#findComment-817426 Share on other sites More sharing options...
Serpens Posted September 24, 2016 Author Share Posted September 24, 2016 Ah, thank you for pointing out the line! One day before I released update 1.01. Cause in 1.00 I did not had that client check, that's why the explosive thing was in line 2. So the solution to the problem is, that "keeper" did not update the mod Link to comment https://forums.kleientertainment.com/forums/topic/70377-how-to-get-if-user-is-client-or-not/#findComment-817436 Share on other sites More sharing options...
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