• 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!

Have problem with change money

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
188
Reaction score
9
GitHub
Jarek123
When player change money can all the time change and when dont have cap or space in backpack drop monet of floor .
I want do when player dont have cap or space in backpack player can not exchange money whow I can change

my sripts change money


1.

function onUse(cid, item, frompos, item2, topos)
if doRemoveItem(item.uid,1) then
doPlayerSendTextMessage(cid,22,"You have changed 1 crystal coin to 100 platinum coins")
doPlayerAddItem(cid,2152,100)
end
end


2.

function onUse(cid, item, frompos, item2, topos)
if item.itemid == 2148 and item.type == 100 then
doRemoveItem(item.uid,item.type)
doPlayerAddItem(cid,2152,1)
doPlayerSendTextMessage(cid,22,"You have changed 100 gp to 1 platnium coin")
elseif item.itemid == 2148 and item.type < 100 then
doPlayerSendTextMessage(cid,22,"You have to got 100 gp's to change for platinum coin")
end
end

3.

function onUse(cid, item, frompos, item2, topos)
if doRemoveItem(item.uid,1) then
doPlayerSendTextMessage(cid,22,"1 Cash Coin is 100 crystal coins")
doPlayerAddItem(cid,2160,100)
end
end
Post automatically merged:

Somebody Can help me?
 
Theres like a million disros with a change gold script, just copy one.

Should also be done in a single onUse function

Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    local coin = config[item.itemid]
    if not coin then
        return false
    end

    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
    elseif coin.changeBack then
        item:transform(item.itemid, item.type - 1)
        player:addItem(coin.changeBack, 100)
    else
        return false
    end
    return true
end
 
Yes but I wouldlike when player dont have capa or places in backpack can not change money because player all the time can exchange money and when dont have places in backpack or capa drop money on floor and can make 100k x money on 1 sqm how I can do when player dont have place in backpack No drop money to floor??
Post automatically merged:

I wouldlike when player dont have place no drop money or items to floor how I can do?
Post automatically merged:

Help guys please
 
Last edited:
Lua:
player:addItem(itemId[, count = 1[, canDropOnMap = true[, subType = 1[, slot = CONST_SLOT_WHEREEVER]]]])

Maybe try with canDropOnMap + add some exhaust condition per IP.
And remember not to remove player cash when player:addItem returns null
 
Yes but I wouldlike when player dont have capa or places in backpack can not change money because player all the time can exchange money and when dont have places in backpack or capa drop money on floor and can make 100k x money on 1 sqm how I can do when player dont have place in backpack No drop money to floor??
Post automatically merged:

I wouldlike when player dont have place no drop money or items to floor how I can do?
Post automatically merged:

Help guys please
You don't even post what distro you're using
 
Back
Top