Maris Posted December 19, 2014 Share Posted December 19, 2014 For example, I want to give a winter hat to Wilson on client. But he does not need hat if there is one near him. If so then he should go and take it by himself.On Server:AddPrefabPostInit("wilson",function(inst) if not find_any_prefab(inst,"winterhat",100) then inst.components.inventory:GiveItem(_G.SpawnPrefab("winterhat")) endend)All fine on server. On clients there is invisible hat.Even if I set all_clients_require_mod = true, clients does not see all items on the server. This data is unavailable for clients. So they can't decide correctly to give or not to give the hat to Wilson.So update function is needed. Link to comment Share on other sites More sharing options...
rezecib Posted December 19, 2014 Share Posted December 19, 2014 @Maris, This code only needs to run on the server. Link to comment Share on other sites More sharing options...
Maris Posted December 19, 2014 Author Share Posted December 19, 2014 (edited) On client there is no visible hat in inventory! And one slot is locked so I can't put there anything if I'm client. Edited December 19, 2014 by Maris Link to comment Share on other sites More sharing options...
rezecib Posted December 19, 2014 Share Posted December 19, 2014 @Maris, Well, 100 is a decent range... are you sure the host Wilson isn't in range? That code should be working. Link to comment 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