Example #1
0
        public void WeaponOnUser(coScriptObject data, coPlayer obj)
            {
            if (obj.getMountedImage(WeaponSlot) == data["image"].AsInt())
                return;

            AudioServerPlay3D("WeaponUseSound", obj.getTransform());


            obj.mountImage(data["image"], WeaponSlot, true, "");

            if (obj["client"].AsBool())
                {
                if (data["description"] != "")

                    MessageClient(obj["client"], "MsgWeaponUsed", "\\c3%1 \\c5 selected.", data["description"]);
                else
                    MessageClient(obj["client"], "MsgWeaponUsed", console.addTaggedString(@"\c0Weapon selected"));
                }

            if (obj.isInNamespaceHierarchy("Player"))
                return;

            obj.allowAllPoses();
            coSimObject image = data["image"];

            if (image["jumpingDisallowed"].AsBool())
                obj.allowJumping(false);

            if (image["jetJumpingDisallowed"].AsBool())
                obj.allowJetJumping(false);

            if (image["sprintDisallowed"].AsBool())
                obj.allowSprinting(false);

            if (image["crouchDisallowed"].AsBool())
                obj.allowCrouching(false);

            if (image["proneDisallowed"].AsBool())
                obj.allowProne(false);

            if (image["swimmingDisallowed"].AsBool())
                obj.allowSwimming(false);
            }