BaiSu Posted July 6, 2015 Share Posted July 6, 2015 If that, I would like to ask.There can be set to a character that only the server administrator to chooseThe average player can not choose the grammar? Link to comment https://forums.kleientertainment.com/forums/topic/55917-about-only-administrators-can-use-role/ Share on other sites More sharing options...
DarkXero Posted July 6, 2015 Share Posted July 6, 2015 local function isPlayerAdmin(player) for k, v in pairs(GLOBAL.TheNet:GetClientTable()) do if v.userid == player.userid then return v.admin end end end local adminonly = { wilson = true, } AddPlayerPostInit(function(inst) if GLOBAL.TheWorld.ismastersim then inst:DoTaskInTime(0, function() if adminonly[inst.prefab] and not isPlayerAdmin(inst) then inst:DoTaskInTime(1, function() inst.components.talker:Say("Picked admin only character.") end) inst:DoTaskInTime(3, function() inst.components.talker:Say("Despawning...") end) inst:DoTaskInTime(5, function() GLOBAL.c_despawn(inst) end) end end) end end) Link to comment https://forums.kleientertainment.com/forums/topic/55917-about-only-administrators-can-use-role/#findComment-652189 Share on other sites More sharing options...
BaiSu Posted July 7, 2015 Author Share Posted July 7, 2015 local function isPlayerAdmin(player) for k, v in pairs(GLOBAL.TheNet:GetClientTable()) do if v.userid == player.userid then return v.admin end endendlocal adminonly = { wilson = true,}AddPlayerPostInit(function(inst) if GLOBAL.TheWorld.ismastersim then inst:DoTaskInTime(0, function() if adminonly[inst.prefab] and not isPlayerAdmin(inst) then inst:DoTaskInTime(1, function() inst.components.talker:Say("Picked admin only character.") end) inst:DoTaskInTime(3, function() inst.components.talker:Say("Despawning...") end) inst:DoTaskInTime(5, function() GLOBAL.c_despawn(inst) end) end end) endend) Oh my goodness!This is really greatI super like him You're a great man!I'm very much obliged to you !!Incidentally.Do you have plans to make a period of time will remove unnecessary objects within the game instructions or modules it? Because my server because too many things seem to lead to LagI checked my system performance, found that he often would go to 100% CPUIt really is a bad thing. Above, thank you very much provides syntax Link to comment https://forums.kleientertainment.com/forums/topic/55917-about-only-administrators-can-use-role/#findComment-652357 Share on other sites More sharing options...
BaiSu Posted July 7, 2015 Author Share Posted July 7, 2015 local function isPlayerAdmin(player) for k, v in pairs(GLOBAL.TheNet:GetClientTable()) do if v.userid == player.userid then return v.admin end endendlocal adminonly = { wilson = true,}AddPlayerPostInit(function(inst) if GLOBAL.TheWorld.ismastersim then inst:DoTaskInTime(0, function() if adminonly[inst.prefab] and not isPlayerAdmin(inst) then inst:DoTaskInTime(1, function() inst.components.talker:Say("Picked admin only character.") end) inst:DoTaskInTime(3, function() inst.components.talker:Say("Despawning...") end) inst:DoTaskInTime(5, function() GLOBAL.c_despawn(inst) end) end end) endend) Sorry, I would like to ask.If you specify a particular User ID selection characterThere are viable grammar? Should I useif (player.userid == KU_V5rTTIug) thenThis syntax it? Link to comment https://forums.kleientertainment.com/forums/topic/55917-about-only-administrators-can-use-role/#findComment-652379 Share on other sites More sharing options...
DarkXero Posted July 7, 2015 Share Posted July 7, 2015 Do you have plans to make a period of time will remove unnecessary objects within the game instructions or modules it? I don't know what an unneccesary object is for you.Unnecessary server strain is something for Klei to fix, many servers that survive for a year (72 days) have this problem. If you think it's due to the stuff other people drop, then you can use thisAddComponentPostInit("inventoryitem", function(self) local function StopDecay(inst, owner) if inst.decayfn then inst.decayfn:Cancel() inst.decayfn = nil end end local function StartDecay(inst) StopDecay(inst) inst.decayfn = inst:DoTaskInTime(480, function() if inst:HasTag("INLIMBO") or inst.components.inventoryitem.owner then return end inst:Remove() end) end self.inst:ListenForEvent("onputininventory", StopDecay) self.inst:ListenForEvent("ondropped", StartDecay)end)so stuff that gets dropped on the floor will disappear after a day. But I can't pinpoint with certainty what causes lag and performance issues. If you specify a particular User ID selection character There are viable grammar? Should I use if (player.userid == KU_V5rTTIug) then This syntax it? local function isPlayerMe(player) return player.userid == "KU_V5rTTIug"end local meonly = { wilson = true,} AddPlayerPostInit(function(inst) if GLOBAL.TheWorld.ismastersim then inst:DoTaskInTime(0, function() if meonly[inst.prefab] and not isPlayerMe(inst) then inst:DoTaskInTime(1, function() inst.components.talker:Say("Picked special character.") end) inst:DoTaskInTime(3, function() inst.components.talker:Say("Despawning...") end) inst:DoTaskInTime(5, function() GLOBAL.c_despawn(inst) end) end end) endend) Link to comment https://forums.kleientertainment.com/forums/topic/55917-about-only-administrators-can-use-role/#findComment-652433 Share on other sites More sharing options...
BaiSu Posted July 9, 2015 Author Share Posted July 9, 2015 (edited) OMG this is really very grateful! He helped me solve the problem has always been - Really appreciate your help Great authors !! Edited July 9, 2015 by BaiSu Link to comment https://forums.kleientertainment.com/forums/topic/55917-about-only-administrators-can-use-role/#findComment-652872 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