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

New Firstitems

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
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, 1987, 1)
		doAddContainerItem(bag, 2674, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end
I need one script of firstitem...
Ex:
[Druid, mage hat, rod, spellbook, cape],
[Knight, random weapon(hatchet, katana or mace), .......].
With all vocations.
With all itens of island of destine.
 
Code:
local kina = { itemid, itemid, itemid }
local druidinha = { itemid, itemid, itemid }
local sorcerezinho = { itemid, itemid, itemid }
local paladinho = {itemid, itemid, itemid }

function onLogin(cid)
	local pV = getPlayerVocation(cid)
    if getPlayerStorageValue(cid, 30001) == -1 then
	local bag = doPlayerAddItem(cid, 1987, 1)
        doAddContainerItem(bag, 2674, 1)
        setPlayerStorageValue(cid, 30001, 1)
		if pV == 1 then
			for i = 1, table.maxn(sorcerezinho) do
				doPlayerAddItem(cid, sorcerezinho[i], 1)
			end
		elseif pV == 2 then
			for i = 1, table.maxn(druidinha) do
				doPlayerAddItem(cid, druidinha[i], 1)
			end
        elseif pV == 3 then
			for i = 1, table.maxn(paladinho) do
				doPlayerAddItem(cid, paladinho[i], 1)
			end
		elseif pV == 4 then
			if rand <= 7 then
				doPlayerAddItem(cid, KATANA, 1)
			elseif (rand > 7 and rand <= 14) then
				doPlayerAddItem(cid, HATCHET, 1)
			elseif (rand > 14 and rand <= 21) then
				doPlayerAddItem(cid, MACE, 1)
			end
			for i = 1, table.maxn(kina) do
				doPlayerAddItem(cid, kina[i], 1)
			end
		end
    end
    return TRUE
end
 
Last edited:
------1º Error:
[25/07/2008 10:51:07] Lua Script Error: [CreatureScript Interface]
[25/07/2008 10:51:07] data/creaturescripts/scripts/firstitems.lua

[25/07/2008 10:51:07] luaDoPlayerAddItem(). Player not found
------Script:
PHP:
local kina = { 2465, 2541, 2481 }
local druidinha = { 8726, 8725, 2175, 2182 }
local sorcerezinho = { 8726, 8725, 2175, 2190 }
local paladinho = { 2655, 2480, 8829, 2456 }
local pala = { 2544 }
local ran = math.random(1, 3)
local pV = getPlayerVocation(cid)
local bag = doPlayerAddItem(cid, 1987, 1)

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
	   doAddContainerItem(bag, 2674, 1)
	   setPlayerStorageValue(cid, 30001, 1)
	if pV == 1 then
  for i = 1, table.maxn(sorcerezinho) do
	   doPlayerAddItem(cid, sorcerezinho[i], 1)
end
	elseif pV == 2 then
  for i = 1, table.maxn(druidinha) do
	   doPlayerAddItem(cid, druidinha[i], 1)
end
	elseif pV == 3 then
  for i = 1, table.maxn(paladinho) do
	   doPlayerAddItem(cid, paladinho[i], 1)
	   doPlayerAddItem(cid, pala[i], 100)
end
	elseif pV == 4 then
		if ran == 1 then 
	   doPlayerAddItem(cid, 8508, 1)
		elseif ran == 2 then 
	   doPlayerAddItem(cid, 8507, 1)
		elseif ran == 3 then 
	   doPlayerAddItem(cid, 2439, 1)
end
  for i = 1, table.maxn(kina) do
	   doPlayerAddItem(cid, kina[i], 1)
   end
  end
 end
   return TRUE
end
------2º Error:
[25/07/2008 10:55:36] Teste Pally has logged in.

[25/07/2008 10:55:36] Lua Script Error: [CreatureScript Interface]
[25/07/2008 10:55:36] data/creaturescripts/scripts/firstitems.lua:onLogin

[25/07/2008 10:55:36] luaDoAddContainerItem(). Container not found
------3º Error:
[25/07/2008 10:56:39] Teste Kina has logged in.

[25/07/2008 10:56:39] Lua Script Error: [CreatureScript Interface]
[25/07/2008 10:56:39] data/creaturescripts/scripts/firstitems.lua:onLogin

[25/07/2008 10:56:39] luaDoAddContainerItem(). Container not found
------4º Error:
[25/07/2008 10:57:04] Account Manager has logged in.

[25/07/2008 10:57:04] Lua Script Error: [CreatureScript Interface]
[25/07/2008 10:57:04] data/creaturescripts/scripts/firstitems.lua:onLogin

[25/07/2008 10:57:04] luaDoAddContainerItem(). Container not found
------Info
Teste Kina = Knight
Teste Pally = Paladin
 
So why changing what Ive posted if you dont know how to? ;/

Youve moved functions with (cid), now the cid for them is nil.
Please move back bag* and pV where it was.

Also, this
Code:
       doPlayerAddItem(cid, pala[i], 100)
will not work, instead of pala put there arrow/bolt id.
 
Now are working:
PHP:
local kina = { 2465, 2541, 2481 } 
local druidinha = { 8726, 8725, 2175, 2182 } 
local sorcerezinho = { 8726, 8725, 2175, 2190 } 
local paladinho = { 2655, 2480, 8829, 2456 } 

function onLogin(cid)
 ran = math.random(1, 3)
 local pV = getPlayerVocation(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
 local bag = doPlayerAddItem(cid, 1987, 1)
	   doAddContainerItem(bag, 2674, 1)
	   setPlayerStorageValue(cid, 30001, 1)
	if pV == 1 then
  for i = 1, table.maxn(sorcerezinho) do
	   doPlayerAddItem(cid, sorcerezinho[i], 1)
end
	elseif pV == 2 then
  for i = 1, table.maxn(druidinha) do
	   doPlayerAddItem(cid, druidinha[i], 1)
end
	elseif pV == 3 then
  for i = 1, table.maxn(paladinho) do
	   doPlayerAddItem(cid, paladinho[i], 1)
end
	elseif pV == 4 then
	if ran == 1 then
	   doPlayerAddItem(cid, 8508, 1)
	elseif ran == 2 then 
	   doPlayerAddItem(cid, 8507, 1)
	elseif ran == 3 then 
	   doPlayerAddItem(cid, 2439, 1)
end
  for i = 1, table.maxn(kina) do
	   doPlayerAddItem(cid, kina[i], 1)
   end
  end
 end
   return TRUE
end
 
Back
Top