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

Voc and Rand

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
Vocation and Random quest:

Don't are working, I'm vaery NOOB =/

Script:
PHP:
function onUse(cid, item, frompos, item2, topos) 
  
if item.uid == 5008 then 
local queststatus = getPlayerStorageValue(cid,5008)
local vocation = getPlayerVocation(cid)
    if queststatus < 1 then 
        ran = math.random(1, 3) 
        setPlayerStorageValue(cid, 5008, 1)
        if ran == 1 and vocation >= 4 then
            doPlayerAddItem(cid, 2376, 1) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2376) .. '.') 
        elseif ran == 2 and vocation >= 4 then
            doPlayerAddItem(cid, 2382, 1) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2382) .. '.') 
        elseif ran == 3 and vocation >= 4 then
            doPlayerAddItem(cid, 2386, 1) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2386) .. '.')
        elseif vocation == 1 then
            doPlayerAddItem(cid, 2190, 1) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2190) .. '.')
        elseif vocation == 2 then
            doPlayerAddItem(cid, 2182, 1) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2182) .. '.')
        elseif vocation == 3 then
            doPlayerAddItem(cid, 2389, 5) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2389) .. '.')
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end
 
Fixed the 'end' part and made it look a little better.
Code:
function onUse(cid, item, frompos, item2, topos) 
  
    local queststatus = getPlayerStorageValue(cid,5008)
    local vocation = getPlayerVocation(cid)
    local ran = math.random(1, 3)
 
    if item.uid == 5008 then 
        if queststatus < 1 then 
            if ran == 1 and vocation >= 4 then
                doPlayerAddItem(cid, 2376, 1)
                setPlayerStorageValue(cid, 5008, 1)                
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2376) .. '.') 
            elseif ran == 2 and vocation >= 4 then
                doPlayerAddItem(cid, 2382, 1) 
                setPlayerStorageValue(cid, 5008, 1)                                
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2382) .. '.') 
            elseif ran == 3 and vocation >= 4 then
                doPlayerAddItem(cid, 2386, 1) 
                setPlayerStorageValue(cid, 5008, 1)                                
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2386) .. '.')
            elseif vocation == 1 then
                doPlayerAddItem(cid, 2190, 1) 
                setPlayerStorageValue(cid, 5008, 1)                                
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2190) .. '.')
            elseif vocation == 2 then
                doPlayerAddItem(cid, 2182, 1) 
                setPlayerStorageValue(cid, 5008, 1)                                
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2182) .. '.')
            elseif vocation == 3 then
                doPlayerAddItem(cid, 2389, 5) 
                setPlayerStorageValue(cid, 5008, 1)                                
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a ' .. getItemName(2389) .. '.')
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
        end
    end
return TRUE
end
 
Back
Top