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

Level VIP

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Reaction score
12
Location
TV
I wanted to pull a lever and buy an item with coins VIP, so it would be 10 coins is the price of VIP sword,is simple but im not scripter.
I REP ++
 
Explain it more: you want a lever that when you pull it you will get VIP sword and pay some coins?
Something like this ?
Code:
function onUse(cid, item, frompos, item2, topos)
local cost = 1000000
local item = xxxx
if doRemovePlayerMoney(cid, cost) == TRUE then
doPlayerAddItem(cid, item, 1)
 doPlayerSendTextMessage(cid,22,"You have bought a sword.")
 else
 doPlayerSendTextMessage(cid,22,"You don't have engouh money.")
end
end
 
Last edited:
Lua:
function onUse(cid, item, frompos, item2, topos)
local cost = 1000000
local item = xxxx
if doPlayerTakeItem(cid, 6527, 10) == TRUE then
doPlayerAddItem(cid, item, 1)
 doPlayerSendTextMessage(cid,22,"You have bought a sword.")
 else
 doPlayerSendTextMessage(cid,22,"You don't have engouh money.")
end
end
 
Last edited:
you dont need this;
Code:
doPlayerSendTextMessage(cid,22,"You don[B][COLOR="Red"]/[/COLOR][/B]'t have engouh money.")
unless u do it like this;
Code:
doPlayerSendTextMessage(cid,22,'You don/'t have engouh money.')
 
Lua:
local t = {
	[1500] = {name='sword', count=1, itemid=2376, cost=10}
	}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local s, i, r = 11551, 6527, t[item.uid]
	if item.uid == r and item.itemid == 1945 then
		if getPlayerStorageValue(cid, s) > 0 then
			if getPlayerItemCount(cid, i) > r.cost then
				doTransformItem(item.uid,item.itemid+1)
				doPlayerGiveItem(cid, r.itemid, r.count)
				doPlayerRemoveItem(cid, r.itemid, r.count)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have bought a '.. r.name .. ' for '.. r.cost .. ' VIP coins.')
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You don\'t have enough money!')
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You are not VIP.')
		end
	elseif item.itemid == 1946 then
		doTransformItem(item.uid,item.itemid-1)
	end
	return true
end

You can sell multiple items with this one.
just make a new line in local t with your unique id.
 
Last edited:
@up
Can't work this way :d

You missed 2x "then"
In line:
PHP:
if item.uid ==  r and item.itemid == 1945
and:
PHP:
elseif item.itemid == 1946
 
simply does not work, I click on the lever but nothing happens, it would not move like I clicked on a rock
 
see
Lua:
local t = {
        [1500] = {name='VIP Sword', count=1, itemid=8932, cost=7},
        [1501] = {name='VIP Axe', count=1, itemid=7435, cost=7},
        [1502] = {name='VIP Club', count=1, itemid=7450, cost=7},
        [1503] = {name='VIP Spear', count=1, itemid=2426, cost=7},
        [1504] = {name='VIP Wand', count=1, itemid=7958, cost=7},
        [1505] = {name='VIP Shield', count=1, itemid=7460, cost=7},
        [1506] = {name='VIP Helmet', count=1, itemid=7458, cost=7},
        [1507] = {name='VIP Armor', count=1, itemid=7463, cost=7},
        [1508] = {name='VIP Shorts', count=1, itemid=7464, cost=7},
        [1509] = {name='VIP Boots', count=1, itemid=7457, cost=7},
        [1510] = {name='Super Refinador', count=1, itemid=8300, cost=1}
        }

function onUse(cid, item, fromPosition, itemEx, toPosition)
local s, i, r = 11551, 6527, t[uid]
        if item.uid == r and item.itemid == 1945 then
                if getPlayerStorageValue(cid, s) > 0 then
                        if getPlayerItemCount(cid, i) > r.cost then
                                doTransformItem(item.uid,item.itemid+1)
                                doPlayerGiveItem(cid, r.itemid, r.count)
                                doPlayerRemoveItem(cid, r.itemid, r.count)
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Você comprou '.. r.name .. ' por '.. r.cost .. ' VIP coins.')
                        else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Você não tem moedas VIP suficiente!')
                        end
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You are not VIP.')
                end
        elseif item.itemid == 1946 then
                doTransformItem(item.uid,item.itemid-1)
        end
        return true
end
 
Lua:
local t = {
        [1500] = {name='VIP Sword', count=1, itemid=8932, cost=7},
        [1501] = {name='VIP Axe', count=1, itemid=7435, cost=7},
        [1502] = {name='VIP Club', count=1, itemid=7450, cost=7},
        [1503] = {name='VIP Spear', count=1, itemid=2426, cost=7},
        [1504] = {name='VIP Wand', count=1, itemid=7958, cost=7},
        [1505] = {name='VIP Shield', count=1, itemid=7460, cost=7},
        [1506] = {name='VIP Helmet', count=1, itemid=7458, cost=7},
        [1507] = {name='VIP Armor', count=1, itemid=7463, cost=7},
        [1508] = {name='VIP Shorts', count=1, itemid=7464, cost=7},
        [1509] = {name='VIP Boots', count=1, itemid=7457, cost=7},
        [1510] = {name='Super Refinador', count=1, itemid=8300, cost=1}
        }

function onUse(cid, item, fromPosition, itemEx, toPosition)
local s, i, r = 11551, 6527, t[uid]
        if item.uid == r and item.itemid == 1945 then
                if getPlayerStorageValue(cid, s) > 0 then
                        if getPlayerItemCount(cid, i) > r.cost then
                                doTransformItem(item.uid,item.itemid+1)
                                doPlayerGiveItem(cid, r.itemid, r.count)
                                doPlayerRemoveItem(cid, r.itemid, r.count)
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Você comprou '.. r.name .. ' por '.. r.cost .. ' VIP coins.')
                        else
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Você não tem moedas VIP suficiente!')
                        end
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You are not VIP.')
                end
        elseif item.itemid == 1946 then
                doTransformItem(item.uid,item.itemid-1)
        end
        return true
end
 
I mean,

Did you create a lever on the map, and gave every lever you made a uniqueid?
Like.

1 lever has uid 1500
another lever has uid 1501

##EDIT
Wrote an entry for every uniqueid in actions.xml?
Lever itemid = 1945?
 
Back
Top