• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Request] Level to buy item off shop list? [Znote]

xx Kami xx

Retired.
Joined
Dec 29, 2012
Messages
509
Reaction score
20
Hello im wondering if its possible to make it so players have to be a certain level to buy a item off the shop?
 
In your npc script, add
Code:
local levelReq = 8
function onTradeRequest(cid)
    local player = Player(cid)
    if not Player(player) then
        return false
    end
   
    return player:getLevel() >= levelReq and true or npcHandler:say("You must be at least level " .. levelReq .. " to trade.", cid)
end

And also add this outside your main callback function
Code:
npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)

Set the offers normally in the npc's xml file

Code:
<parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="assassin star,7368,100" />
 
Back
Top