• 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 ++
 
Code:
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[item.uid]
	if r and (item.itemid == 1945 or item.itemid == 1946) then
		if getPlayerStorageValue(cid, s) > 0 then
			if getPlayerItemCount(cid, i) > r.cost then
				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.')
				return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
			else
				return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Você n?o tem moedas VIP suficiente!')
			end
		else
			return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You are not VIP.')
		end
	end
end
 
sorry I did not understand your question, I used the same lever 1945 in mapeditor arise in unique ID or action ID.

google translator. =/
 
Have you made entries for uniqueid in actions.xml?

Lua:
<action uniqueid="1500" event="script" value="script_name.lua"/>
<action uniqueid="1501" event="script" value="script_name.lua"/>

Xeon only changed that it is usable on every use.

##
@Xeon (if you read)
Why do you return doTransformItem and doPlayerSendMessage?
 
so that my
Lua:
<action actionid="1500" script="VIP/lavanca.lua" />
<action actionid="1501" script="VIP/lavanca.lua" />
<action actionid="1502" script="VIP/lavanca.lua" />
<action actionid="1503" script="VIP/lavanca.lua" />
<action actionid="1504" script="VIP/lavanca.lua" />
<action actionid="1505" script="VIP/lavanca.lua" />
<action actionid="1506" script="VIP/lavanca.lua" />
<action actionid="1507" script="VIP/lavanca.lua" />
<action actionid="1508" script="VIP/lavanca.lua" />
<action actionid="1509" script="VIP/lavanca.lua" />
<action actionid="1510" script="VIP/lavanca.lua" />
 
Make it uniqueid!
I made the script work for unique id, not actionid.

##
Lua:
<action actionid="1500" script="VIP/lavanca.lua" />
<action uniqueid="1501" script="VIP/lavanca.lua" />
<action uniqueid="1502" script="VIP/lavanca.lua" />
<action uniqueid="1503" script="VIP/lavanca.lua" />
<action uniqueid="1504" script="VIP/lavanca.lua" />
<action uniqueid="1505" script="VIP/lavanca.lua" />
<action uniqueid="1506" script="VIP/lavanca.lua" />
<action uniqueid="1507" script="VIP/lavanca.lua" />
<action uniqueid="1508" script="VIP/lavanca.lua" />
<action uniqueid="1509" script="VIP/lavanca.lua" />
<action uniquenid="1510" script="VIP/lavanca.lua" />
 
you made a check if the play has a certain item it should do whatever you wanted it to, check if you have the item
 
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 i, r = 6527, t[item.uid]
	if r and (item.itemid == 1945 or item.itemid == 1946) then
		if getPlayerItemCount(cid, i) > r.cost then
			doPlayerGiveItem(cid, r.itemid, r.count)
			doPlayerRemoveItem(cid, r.itemid, r.count)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Voce comprou '.. r.name .. ' por '.. r.cost .. ' VIP coins.')
			return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
		else
			return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Voce n?o tem moedas VIP suficiente!')
		end
	end
end
 
Back
Top