• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Quest Vocation Help

Dkadsfe

Member
Joined
Apr 1, 2016
Messages
280
Reaction score
22
Code:
function onUse(cid, item, frompos, item2, topos)
if getPlayerStorageValue(cid,4028) == -1 then
doPlayerAddItem(cid,7735)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"congrats")
setPlayerStorageValue(cid,4028,1)
doSendMagicEffect(getPlayerPosition(cid),28)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"empty")
end
return 1
end
Hi guys make this code turn into a vocation needed script? vocations 1-9 gets item 7735 and vocation 10 gets item 10312
 
Dam i should take a nap... this code does not look right
Never mind I fixed it.
Code:
local freeItens = {
    [{1,2,3,4,5,6,7,8,9}] = {item = 7735, amount = 1},
    [{10}] = {item = 10312, amount = 1}
}

local storage = 4028

function onUse(cid, item, frompos, item2, topos)
    local vocation = getPlayerVocation(cid)
    for id, rewards in pairs(freeItens) do
        if isInArray(id, vocation) then
            if getPlayerStorageValue(cid, storage) < 0 then
                doPlayerAddItem(cid, rewards[i].item, rewards[i].amount)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congrats... I was too lazy to write this myself!")
                setPlayerStorageValue(cid, storage, 1)
                doSendMagicEffect(getPlayerPosition(cid), 28)
            end
        end
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Its empty :(")
    return true
end
 
Dam i should take a nap... this code does not look right
Code:
local rewards = {
    [{1,2,3,4,5,6,7,8,9}] = {item = 7735, amount = 1},
    [{10}] = {item = 10312, amount = 1}
}

local storage = 4028

function onUse(cid, item, frompos, item2, topos)
    local vocation = getPlayerVocation(cid)
    for i = 1, #rewards do
        if isInArray(rewards[i], vocation) then
            if getPlayerStorageValue(cid, storage) < 0 then
                doPlayerAddItem(cid, rewards[i].item, rewards[i].amount)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congrats... I was too lazy to write this myself!")
                setPlayerStorageValue(cid, storage, 1)
                doSendMagicEffect(getPlayerPosition(cid), 28)
            end
        end
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Its empty :(")
    return true
end
Hey this is a nice script except that when i use it it says its empty :(
even for new characters
 
That is because you are too quick to copy and paste, i updated it, you commented the old version and on top of that you didn't read what i wrote.

Your actions have summed up 95% of this community...
That is because you are too quick to copy and paste, i updated it, you commented the old version and on top of that you didn't read what i wrote.

Your actions have summed up 95% of this community...
Is this for tfs 0.3.6? btw the new one also says the same thing but only admins can use it
it also says
Code:
[07/05/2016 14:20:43] Description:
[07/05/2016 14:20:43] data/actions/scripts/youbro/prwep.lua:13: attempt to index field '?' (a nil value)
[07/05/2016 14:20:43] stack traceback:
[07/05/2016 14:20:43]     data/actions/scripts/youbro/prwep.lua:13: in function <data/actions/scripts/youbro/prwep.lua:8>
 
I am taking a nap... i am getting cranky too
Code:
local freeItens = {
    [{1,2,3,4,5,6,7,8,9}] = {item = 7735, amount = 1},
    [{10}] = {item = 10312, amount = 1}
}

local storage = 4028

function onUse(cid, item, frompos, item2, topos)
    local vocation = getPlayerVocation(cid)
    for id, rewards in pairs(freeItens) do
        if isInArray(id, vocation) then
            if getPlayerStorageValue(cid, storage) < 0 then
                doPlayerAddItem(cid, rewards.item, rewards.amount)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congrats... I was too lazy to write this myself!")
                setPlayerStorageValue(cid, storage, 1)
                doSendMagicEffect(getPlayerPosition(cid), 28)
            end
        end
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Its empty :(")
    return true
end
 
Back
Top