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

what is wrong with my script ?

Venn

Member
Joined
Aug 16, 2009
Messages
547
Reaction score
20
what is wrong ?

script
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local i = getPlayerVocation(cid)
		if i == 5 then
			vocation = "Wizard"
		elseif i == 6 then
			vocation = "Summoner"
		elseif i == 7 then
			vocation = "Assassin"
		elseif i == 8 then
			vocation = "Warrior"
		end

	if getPlayerVipDays(cid) == 0 then
		doPlayerSendCancel(cid,"You need to be a vip in order to use this item.")
	else
		if getPlayerPromotionLevel(cid) == 1 then
			setPlayerPromotionLevel(cid, 2)
			doCreatureSay(cid, "You are now a "..vocation.."", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid, 1)
		else
			doPlayerSendCancel(cid,"You need to be promoted in order to use this item.")
		end
	end
end

function
Code:
--- Vip functions by Kekox
function getPlayerVipDays(cid)
    local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local days= Info:getDataInt("vipdays")
        Info:free()
        return days
    end
     return LUA_ERROR
end
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVipDays(cid) == 0 then
		doPlayerSendCancel(cid, "You need to be a vip in order to use this item.")
		return true
	end
	
	return getPlayerPromotionLevel(cid) == 1 and setPlayerPromotionLevel(cid, 2) and doCreatureSay(cid, "You are now a " .. getPlayerVocation(cid) .. "", TALKTYPE_ORANGE_1) and doRemoveItem(item.uid, 1) or doPlayerSendCancel(cid,"You need to be promoted in order to use this item.")
end
 
if i use it and want use it second time it say u need to be promoted.
it should say u can use it once or something
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVipDays(cid) == 0 then
		return doPlayerSendCancel(cid, 'You need to be a vip in order to use this item.')
	end

	local k = getPlayerPromotionLevel(cid)
	if k == 0 then
		doPlayerSendCancel(cid, 'You need to be promoted in order to use this item.')
	elseif k == 1 then
		setPlayerPromotionLevel(cid, 2)
		doCreatureSay(cid, 'You are now ' .. getVocationInfo(getPlayerVocation(cid)).description .. '.', TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
	else
		doPlayerSendCancel(cid, 'You can only use it once.')
	end
	return true
end
 
Back
Top