Sign in to follow this  
chkang

Restrict number of construction object based on UID

3 posts in this topic

Hi guys 

I'm making some stuffs that restrict the number of object that players can build(Tents, Vault ets..).

 

Here's my stuffs.

Quote

if(_itemClassName isEqualTo "Exile_Item_CamoTentKit") then
        {
            myUID = getPlayerUID player;
            _numberOfTents = 0;
            {
                _ownerUid = _x getVariable ["ExileOwnerUID", ""];
                if (_ownerUid isEqualTo myUID) then 
                {
                    _numberOfTents = _numberOfTents + 1;
                };
                
            }forEach (allMissionObjects "Exile_Container_CamoTent");
            if(_numberOfTents>1) then
            {
                ["RestartWarning",[format["Dont"]]] call ExileClient_gui_notification_event_addNotification;
            };
            
        }
        else 
        {
            [_itemClassName] call ExileClient_construction_beginNewObject;
        };

 

Above code is part of the  'ExileClient_object_item_construct.sqf'

My concept is like this, If a user already have a "Exile_Container_CamoTent" then  He can't make tent anymore.

I think this part is something wrong..

            {

                _ownerUid = _x getVariable ["ExileOwnerUID", ""];   <-- This part is mess please give me some advice. I'm not sure that getting a container's accoun_uid(which means owner)
                if (_ownerUid isEqualTo myUID) then 
                {
                    _numberOfTents = _numberOfTents + 1;
                };
                
            }forEach (allMissionObjects "Exile_Container_CamoTent");

 

 

Thank you for your reading

 

 

 

 

 

 

 

Edited by chkang

Share this post


Link to post
Share on other sites
Advertisement

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.