Jump to content
Sign in to follow this  
Mario

Help on this script

Recommended Posts

function Lv101GearChest( role, Item)

    local i= CheckBagItem( role,  18807  )    
    if i <=0 then
        SystemNotice(  role , "It appears you do not have enough keys or you have the wrong keys ")
        UseItemFailed ( role )
        return LUA_FALSE
    end
    
    
    local i = DelBagItem ( role , 18807 , 1 ) 
    
    local Item_CanGet = GetChaFreeBagGridNum ( role )
    if Item_CanGet <= 2 then
        SystemNotice(role ,"Insufficient inventory space. Unable to use V1 Gear Chest")
        UseItemFailed ( role )
        return
    end
    
    
  local job = GetChaAttr(role, ATTR_JOB)
    local Item_CanGet = GetChaFreeBagGridNum ( role )
    if Item_CanGet <= 2 then
        SystemNotice(role ,"Insufficient inventory space. Unable to use V1 Gear Chest")
        UseItemFailed ( role )
        return
    end
    if job == 9 then--cruseder
        GiveItem ( role , 0 , 2331 , 2 , 6 )

    elseif job == 14 then--sealmaster     
        GiveItem ( role , 0 , 2343 , 1 , 6 ) 

    elseif job == 16 then--voyger         
        GiveItem ( role , 0 , 2336 , 1 , 6 )

    elseif job == 12 then--Hunter         
        GiveItem ( role , 0 , 2338 , 1 , 6 )

    elseif job == 8 then--champ          
        GiveItem ( role , 0 , 2333 , 1 , 6 )
        
    elseif job == 13 then--cleric         
        GiveItem ( role , 0 , 2341 , 1 , 6 )
        
    
    else
        SystemNotice(role ,"Available for 2st Classes only!. Unable to open Chest")
        UseItemFailed ( role )
        return
    end
    

end

 

every thing fine on this chest but if there is no space trigger fail  it deletes the key , how i can prevent that ?

how could i make this role   >>   local i = DelBagItem ( role , 18807 , 1 )  works only when spaces ok so if there is no space it should give massage with out deleteing this key 

 

any help ? 


 

Share this post


Link to post
Share on other sites

Hello @Mario,

 

Move line:

local i = DelBagItem ( role , 18807 , 1 ) 

to the end of the function:

    . . .

	else
        SystemNotice(role ,"Available for 2st Classes only!. Unable to open Chest")
        UseItemFailed ( role )
        return
    end

    local i = DelBagItem ( role , 18807 , 1 ) 

end

 


Share this post


Link to post
Share on other sites

Hello @Mario,

 

Unfortunately, I don't provide any services at the moment. You can create a topic with your request here.


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...