IndeedPete 1038 Posted November 22, 2014 Heya! Some of you may know my shop system from M.E.R.C.S. I'm currently porting it to an MP environment for a new project. Having some small troubles with addWeaponCargo / addMagazineCargo / addItemCargo. Just for the record: The shop system runs client-side and adds / removes bought / sold stuff to / from an ordinary, editor-placed weapon box. I've planned to use the limited local effect addWeaponCargo offers (on the contrary to addWeaponCargoGlobal) so each player will have his own box with contents only he can see / manipulate. However, I've encountered two problems: 1. addWeaponCargo doesn't seem to work on a client when the box is not local to him (even if stated otherwise in the biki). The buying process works as planned, money gets removed and the script runs the addWeaponCargo. But the box stays empty. It's working just fine when the buyer is also the server. 2. If the server-side buyer takes something from his personal instance of the box and then puts it back it is synched across the network, means other players can take it or sell it. Any known way to disable synchronisation across the network? Any help or ideas for a workaround are appreciated! :) Share this post Link to post Share on other sites
Jigsor 175 Posted November 23, 2014 Maybe add InventoryOpened EH to player, then check for type of ammo box container: Object - connected container or weaponholder, Then inventory the box and add InventoryClosed EH to player and refill the box with inventories items? Share this post Link to post Share on other sites
IndeedPete 1038 Posted November 23, 2014 Not sure if I'm getting your point. You mean like queuing the bought / sold items and then adding / removing them when the player accesses the box? As said, addWeaponCargo / removeWeaponCargo doesn't seem to work when the box isn't local to the client who's running the command - even if the wiki says Arguments - Global, Effect - Local. Share this post Link to post Share on other sites
Naiss 28 Posted November 23, 2014 i think something like this should work Car1 addWeaponCargo "Class name here"; //or you can do it like this _car = cursorTarget; _car addWeaponCargo "Class name here"; //Remove from cargo _car = cursorTarget; _car clearWeaponCargo; Share this post Link to post Share on other sites
Jigsor 175 Posted November 23, 2014 Ahh, scratch that. Yeah there is a locality issue there. Sorry all I can think of is to create it locally and add/remove contents. Share this post Link to post Share on other sites
Magirot 14 Posted November 23, 2014 Maybe it works if you create the box locally for each player with createVehicleLocal? Share this post Link to post Share on other sites
IndeedPete 1038 Posted November 23, 2014 @lifemanlive: As said, addWeaponCargo / removeWeaponCargo doesn't seem to work when the box isn't local to the client who's running the command - even if the wiki says Arguments - Global, Effect - Local. @Jigsor, Magirot: Yeah, thought the same thing. Odd though that it doesn't work as the wiki suggests. Maybe these commands are buggy after all? But creating the box locally would also get rid of that unwanted sync, right? Should try that, thanks guys! Share this post Link to post Share on other sites
killzone_kid 1326 Posted November 23, 2014 Inventory/cargo commands have been tweaked and tweaked and tweaked more so many times that you should not really trust what biki says but test yourself. Perhaps you should try what Magirot suggested and use createVehicleLocal. Share this post Link to post Share on other sites
IndeedPete 1038 Posted November 23, 2014 So, I've tried the create-that-box-locally-approach and it seems to work. Players can't access anyone else's stuff and the add / remove commands seem to work as well. A piece of code run on every client: if ((isNil "IP_PlayerBox") OR {isNull IP_PlayerBox}) then { _pos = [15331.6, 16105.5, 3.95283]; IP_PlayerBox = "Box_NATO_Wps_F" createVehicleLocal [15331.6, 16105.5, 3.95283]; IP_PlayerBox setPosATL _pos; IP_PlayerBox setDir -15.4642; clearWeaponCargo IP_PlayerBox; clearMagazineCargo IP_PlayerBox; clearItemCargo IP_PlayerBox; }; Thanks again, guys! Share this post Link to post Share on other sites