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

Solved Help with Script

Phemus

Member
Joined
Jun 16, 2012
Messages
150
Solutions
2
Reaction score
13
Hi, I'm helping a friend with a script but it seems that i also need help...
This is the Script:

PHP:
-- vocs -----
-- actionid: 8605 sorc
-- actionid: 8606 druid
-- actionid: 8607 pally
-- actionid: 8608 knight

local firstItems = {
  { -- SORC ITEMS
    {itemid=2173, count=1}, -- hat of the mad
    {itemid=2481, count=1}, -- hat of the mad
    {itemid=2465, count=1}, -- focus cape
    {itemid=2478, count=1}, -- blue legs
    {itemid=2643, count=1}, -- boots of haste
    {itemid=2509, count=1}, -- spellbook of mind control
    {itemid=2188, count=1}, -- wand of inferno
  }
}
function onUse(cid, item, frompos, item2, topos)

newtemple = {x=694, y=849, z=7}

    if getPlayerLevel(cid) >= 1 then
        doPlayerSendTextMessage(cid,22,"Good look " .. getCreatureName(cid) .. ".")
        if getPlayerVocation(cid) == 5 and getPlayerStorageValue(cid,4856) <= 1 then
                        local container = doPlayerAddItem(cid, 10519, 1) --Backpack
            doAddContainerItem(container, 2293, 1)
            doAddContainerItem(container, 2273, 1)
            doAddContainerItem(container, 2305, 1)
            doAddContainerItem(container, 2286, 1)
            doAddContainerItem(container, 2262, 1)
            doAddContainerItem(container, 2268, 1)
            doAddContainerItem(container, 2301, 1)
            doAddContainerItem(container, 2277, 1)
            doAddContainerItem(container, 2310, 1)
            doAddContainerItem(container, 2261, 1)
            doAddContainerItem(container, 2274, 1)
            doAddContainerItem(container, 2304, 1)
            doAddContainerItem(container, 2315, 1)
            doAddContainerItem(container, 7590, 1)
        doPlayerAddItem(cid, 10518, 1)   
        doPlayerAddItem(cid, 2323, 1)
        doPlayerAddItem(cid, 8871, 1)
        doPlayerAddItem(cid, 7730, 1)
        doPlayerAddItem(cid, 2187, 1)
        doPlayerAddItem(cid, 2195, 1)
        doPlayerAddItem(cid, 8902, 1)
        doPlayerAddItem(cid, 2554, 1)
        doPlayerAddItem(cid, 2420, 1)
        doPlayerAddItem(cid, 2120, 1)
        doPlayerAddItem(cid, 2789, 1)
            doTeleportThing(cid,newtemple,0)
            setPlayerStorageValue(cid, 4856, 1)
        elseif getPlayerVocation(cid) == 6 and getPlayerStorageValue(cid,4856) <= 1 then
                        local container = doPlayerAddItem(cid, 2001, 1)-- Purple Backpack
            doAddContainerItem(container, 2293, 1)-- Magic Wall Rune
            doAddContainerItem(container, 2273, 1)-- Ultimate Healig Rune
            doAddContainerItem(container, 2305, 1)-- Fire Bomb Rune
            doAddContainerItem(container, 2286, 1)-- Poison Bomb Rune
            doAddContainerItem(container, 2262, 1)-- Energy Bomb Rune
            doAddContainerItem(container, 2268, 1)-- Sudden Death Rune
            doAddContainerItem(container, 2301, 1)-- Fire Field Rune
            doAddContainerItem(container, 2277, 1)-- Energy Field Rune
            doAddContainerItem(container, 2310, 1)-- Desintegrate Rune
            doAddContainerItem(container, 2261, 1)-- Destoy Field Rune
            doAddContainerItem(container, 2274, 1)-- Avalanche Rune
            doAddContainerItem(container, 2304, 1)-- Great Fire Ball Rune
            doAddContainerItem(container, 2315, 1)-- Thunderstorm Rune
            doAddContainerItem(container, 2278, 1)-- Paralize Rune
            doAddContainerItem(container, 2269, 1)-- Wild Growth Rune
            doAddContainerItem(container, 7590, 1)-- Great Mana Potion
        doPlayerAddItem(cid, 5949, 1)-- Beach backpack   
        doPlayerAddItem(cid, 2323, 1)-- hat of the mad
        doPlayerAddItem(cid, 8871, 1)-- Focus cape
        doPlayerAddItem(cid, 7730, 1)-- Blue legs
        doPlayerAddItem(cid, 2183, 1)-- Hailstorm Rod
        doPlayerAddItem(cid, 2195, 1)-- Boots of Haste
        doPlayerAddItem(cid, 8902, 1)-- Spell Book of Mind Control
        doPlayerAddItem(cid, 2554, 1)-- Shovel
        doPlayerAddItem(cid, 2420, 1)-- Machete
        doPlayerAddItem(cid, 2120, 1)-- Rope
        doPlayerAddItem(cid, 2789, 1)-- Brown Mushroom
            doTeleportThing(cid,newtemple,0)
            setPlayerStorageValue(cid, 4856, 1)
        elseif getPlayerVocation(cid) == 7 and getPlayerStorageValue(cid,4856) <= 1 then
                        local container = doPlayerAddItem(cid, 2003, 1)-- Grey Backpack
            doAddContainerItem(container, 8472, 1)-- Great Spirit Potion
            doAddContainerItem(container, 7589, 1)-- Strong Mana Potion
            doAddContainerItem(container, 7588, 1)-- Strong Health Potion
            doAddContainerItem(container, 2293, 1)-- Magic Wall Rune
            doAddContainerItem(container, 2273, 1)-- Ultimate Healig Rune
            doAddContainerItem(container, 2305, 1)-- Fire Bomb Rune
            doAddContainerItem(container, 2286, 1)-- Poison Bomb Rune
            doAddContainerItem(container, 2262, 1)-- Energy Bomb Rune
            doAddContainerItem(container, 2301, 1)-- Fire Field Rune
            doAddContainerItem(container, 2277, 1)-- Energy Field Rune
            doAddContainerItem(container, 2310, 1)-- Desintegrate Rune
            doAddContainerItem(container, 2261, 1)-- Destoy Field Rune
            doAddContainerItem(container, 2274, 1)-- Avalanche Rune
            doAddContainerItem(container, 2304, 1)-- Great Fire Ball Rune
            doAddContainerItem(container, 2315, 1)-- Thunderstorm Rune       
        doPlayerAddItem(cid, 9774, 1)-- Brocade backpack   
        doPlayerAddItem(cid, 2498, 1)-- Royal Helmet
        doPlayerAddItem(cid, 2470, 1)-- Golden Legs
        doPlayerAddItem(cid, 8891, 1)-- Paladin Armor
        doPlayerAddItem(cid, 2195, 1)-- Boots of Haste
        doPlayerAddItem(cid, 7368, 1)-- Assassin Star
        doPlayerAddItem(cid, 2514, 1)-- Mastermind Shield
        doPlayerAddItem(cid, 2554, 1)-- Shovel
        doPlayerAddItem(cid, 2420, 1)-- Machete
        doPlayerAddItem(cid, 2120, 1)-- Rope
        doPlayerAddItem(cid, 2789, 1)-- Brown Mushroom
            doTeleportThing(cid,newtemple,0)
            setPlayerStorageValue(cid, 4856, 1)
        elseif getPlayerVocation(cid) == 8 and getPlayerStorageValue(cid,4856) <= 1 then
                        local container = doPlayerAddItem(cid, 2002, 1)-- Grey Backpack
            doAddContainerItem(container, 8472, 1)-- Ultimate Health Potion
            doAddContainerItem(container, 7620, 1)-- Mana Potion
            doAddContainerItem(container, 7588, 1)-- Strong Health Potion
            doAddContainerItem(container, 2293, 1)-- Magic Wall Rune
            doAddContainerItem(container, 2273, 1)-- Ultimate Healig Rune
            doAddContainerItem(container, 2305, 1)-- Fire Bomb Rune
            doAddContainerItem(container, 2286, 1)-- Poison Bomb Rune
            doAddContainerItem(container, 2262, 1)-- Energy Bomb Rune
            doAddContainerItem(container, 2301, 1)-- Fire Field Rune
            doAddContainerItem(container, 2277, 1)-- Energy Field Rune
            doAddContainerItem(container, 2310, 1)-- Desintegrate Rune
            doAddContainerItem(container, 2261, 1)-- Destoy Field Rune
            doAddContainerItem(container, 2274, 1)-- Avalanche Rune
            doAddContainerItem(container, 2304, 1)-- Great Fire Ball Rune
            doAddContainerItem(container, 2315, 1)-- Thunderstorm Rune
            doAddContainerItem(container, 2313, 1)-- Explosion Rune           
        doPlayerAddItem(cid, 5926, 1)-- Pirate backpack   
        doPlayerAddItem(cid, 2498, 1)-- Royal Helmet
        doPlayerAddItem(cid, 2470, 1)-- Golden Legs
        doPlayerAddItem(cid, 2472, 1)-- Magic Plate Armor
        doPlayerAddItem(cid, 2195, 1)-- Boots of Haste
        doPlayerAddItem(cid, 2400, 1)-- Magic Sword
        doPlayerAddItem(cid, 2421, 1)-- Thunder Hammer
        doPlayerAddItem(cid, 2431, 1)-- Stonecutter Axe
        doPlayerAddItem(cid, 2514, 1)-- Mastermind Shield
        doPlayerAddItem(cid, 2554, 1)-- Shovel
        doPlayerAddItem(cid, 2420, 1)-- Machete
        doPlayerAddItem(cid, 2120, 1)-- Rope
        doPlayerAddItem(cid, 2789, 1)-- Brown Mushroom
            doTeleportThing(cid,newtemple,0)
            setPlayerStorageValue(cid, 4856, 1)
            else
            doSendMagicEffect(toPosition, 2)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already got your items.")
        end
        doSendMagicEffect(topos,12)
        return 1
        else
        return 0
    end
end

What i want is that the players only can use the chest one time.. the problem is that it gives to you the items many times.
 
lol why don't you make first items :D

that's really shit thing
I prefer creaturescript :D

Code:
function onLogin(cid)
    local storage = 30055 -- storage value
   
    local sorcItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2190, -- Wand of vortex
            2511, -- Brass shield
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local druidItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2182, -- Snakebite rod
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local pallyItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2456, -- Bow
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
        }
    local kinaItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2412, -- Katana
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
   
    if getPlayerStorageValue(cid, storage) == -1 then
        setPlayerStorageValue(cid, storage, 1)
        if getPlayerVocation(cid) == 1 then
            -- Sorcerer
            for i = 1, table.getn(sorcItems), 1 do
                doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 2 then
            -- Druid
            for i = 1, table.getn(druidItems), 1 do
                doPlayerAddItem(cid, druidItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 3 then
            -- Paladin
            for i = 1, table.getn(pallyItems), 1 do
                doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
            end
            -- 8 arrows
            doPlayerAddItem(cid, 2544, 8, FALSE)
       
        elseif getPlayerVocation(cid) == 4 then
            -- Knight
            for i = 1, table.getn(kinaItems), 1 do
                doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
            end
        end
       
        -- Common for all
        doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
        doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
    end
    return true
end
 
Oki
take the code I gave you
and paste it in firstitems.lua in creaturescript folder

and in creaturescripts.xml make sure it's registered
Code:
<event type="login" name="firstItems" event="script" value="firstitems.lua"/>

and in login.lua in creaturescripts folder
register the event

Code:
registerCreatureEvent(cid, "firstItems")
 
Back
Top