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

[Help] First Items and First Skills

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
This scripts aren't working as they should work, could anyone help me?

Start Skills:
Code:
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56367
local gotSkills = getPlayerStorageValue(cid, 56364)


if playerVoc == 5 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,60)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 6 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,60)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 7 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 60))
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,15)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 8 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 71))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 71))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 60))
doPlayerAddMagLevel(cid, 9)
setPlayerStorageValue(cid, skillStor, 1)

end
return TRUE
end

First Items:
Code:
local commonItems = {
  -- ITEMS ALL VOCS RECEIVE
  {itemid=2120, count=1}, -- rope
  {itemid=5710, count=1}, -- shovel
  {itemid=2420, count=1}, -- machete
  {itemid=2789, count=50}, -- brown mushrooms
  {itemid=2305, count=1}, -- fire bomb rune
  {itemid=2261, count=1}, -- destroy field rune
}

local firstItems = {
  { -- SORC ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=8902, count=1}, -- spellbook of mind control
    {itemid=2187, count=1}, -- wand of inferno 

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
  },
  { -- DRUID ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=8902, count=1}, -- spellbook of mind control
    {itemid=2183, count=1}, -- hailstorm rod  

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
    {itemid=2269, count=1}, -- wg
    {itemid=2278, count=1}, -- para
  },
  { -- PALADIN ITEMS
    {itemid=2493, count=1}, -- demon helmet
    {itemid=8891, count=1}, -- paladin armor
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=2514, count=1}, -- mastermind shield
    {itemid=7368, count=1}, -- assassin stars

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=8472, count=1}, -- gsp
    {itemid=7589, count=1}, -- smp
    {itemid=7588, count=1}, -- shp
    {itemid=2293, count=1}, -- mw
  },
  { -- KNIGHT ITEMS
    {itemid=2493, count=1}, -- demon helmet
    {itemid=2472, count=1}, -- magic plate armor
    {itemid=2470, count=1}, -- golden legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=2514, count=1}, -- mastermind shield
    {itemid=2400, count=1}, -- magic sword

    {itemid=7620, count=1}, -- mp
    {itemid=7591, count=1}, -- ghp
    {itemid=8473, count=1}, -- uhp
    {itemid=2273, count=1}, -- uh
    {itemid=2293, count=1}, -- mw
  }
}

for _, items in ipairs(firstItems) do
  for _, item in ipairs(commonItems) do
    table.insert(items, item)
  end
end

function onLogin(cid)
  if getPlayerGroupId(cid) < 2 then
    local hasReceivedFirstItems = getPlayerStorageValue(cid, 67708)

    if hasReceivedFirstItems ~= 1 then
      --[[local backpack = ]]doPlayerAddItem(cid, 1988, 1)

      local giveItems = firstItems[getPlayerVocation(cid)]

      if giveItems ~= nil then
        for _, v in ipairs(giveItems) do
          --doAddContainerItem(backpack, v.itemid, v.count or 1)
          doPlayerAddItem(cid, v.itemid, v.count or 1)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have received your first items!")
      end
      setPlayerStorageValue(cid, 67708, 1)
    end
  end
  return TRUE
end
 
Firstitems.lua
PHP:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		if getPlayerSex(cid) == 0 then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end
		local bag = doPlayerAddItem(cid, 2000, 1)
		doAddContainerItem(bag, 2674, 1)
		doAddContainerItem(bag, 2463, 1)
		doAddContainerItem(bag, 2647, 1)
		doAddContainerItem(bag, 2490, 1)
		doAddContainerItem(bag, 2182, 1)
		doAddContainerItem(bag, 2160, 2)
		doAddContainerItem(bag, 2190, 2)
		doAddContainerItem(bag, 2383, 2)
		doAddContainerItem(bag, 2430, 2)
		doAddContainerItem(bag, 2434, 2)
            doAddContainerItem(bag, 2521, 1)
            doAddContainerItem(bag, 2389, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end
 
Back
Top