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

change gold

Status
Not open for further replies.

Ferdek Kiepski

Banned User
Joined
Dec 22, 2009
Messages
157
Reaction score
2
Czesc
Przerobcie mi ten skrypt kotki moje kochane
PHP:
local coins = {
	[ITEM_GOLD_COIN] = {
		to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
	},
	[ITEM_PLATINUM_COIN] = {
		from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN,z effect = TEXTCOLOR_LIGHTBLUE
	},
	[ITEM_CRYSTAL_COIN] = {
		from = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_TEAL
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local coin = coins[item.itemid]
	if(not coin) then
		return FALSE
	end

	if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, coin.to, 1)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
	elseif(coin.from ~= nil) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return TRUE
end

zeby nie dalo sie 1cc zamieniac na nic a reszta normalnie tylko zeby niebieskich sie nie dalo ruszac :):peace:
 
Nie sprawdzałem, ale są duże szanse, że tak:
Code:
local coins = { 
    [ITEM_GOLD_COIN] = { 
        to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW 
    }, 
    [ITEM_PLATINUM_COIN] = { 
        from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN,z effect = TEXTCOLOR_LIGHTBLUE 
    }
} 
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    local coin = coins[item.itemid] 
    if(not coin) then 
        return FALSE 
    end 
 
    if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, coin.to, 1) 
        doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect) 
    elseif(coin.from ~= nil) then 
        doChangeTypeItem(item.uid, item.type - 1) 
        doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect) 
    end 
    return TRUE 
end

 
ok dziala tylko jakis error
Code:
[24/10/2010 12:57:19] Lua Script Error: [Action Interface] 
[24/10/2010 12:57:19] data/actions/scripts/other/changegold.lua:onUse

[24/10/2010 12:57:19] data/actions/scripts/other/changegold.lua:19: attempt to index field '?' (a nil value)
[24/10/2010 12:57:19] stack traceback:
[24/10/2010 12:57:19] 	data/actions/scripts/other/changegold.lua:19: in function <data/actions/scripts/other/changegold.lua:10>
 
Hmm, racja, zapomniałem o jednej rzeczy.

Code:
local coins = { 
    [ITEM_GOLD_COIN] = { 
        to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW 
    }, 
    [ITEM_PLATINUM_COIN] = { 
        from = ITEM_GOLD_COIN, z effect = TEXTCOLOR_LIGHTBLUE 
    }
} 
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    local coin = coins[item.itemid] 
    if(not coin) then 
        return FALSE 
    end 
 
    if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then 
        doChangeTypeItem(item.uid, item.type - item.type) 
        doPlayerAddItem(cid, coin.to, 1) 
        doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect) 
    elseif(coin.from ~= nil) then 
        doChangeTypeItem(item.uid, item.type - 1) 
        doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX) 
        doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect) 
    end 
    return TRUE 
end

 
Status
Not open for further replies.

Similar threads

Back
Top