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

Need help with First items!!!

naod123456

Wazzaap
Joined
Mar 28, 2013
Messages
242
Reaction score
4
Hi i got a server everything is working good, but not the first item i got this scripts on my firstitem is it wrong with it?
LUA:
local commonItems = { 
  -- ITEMS ALL VOCS RECEIVE
  {itemid=2120, count=1}, -- rope
  {itemid=5710, count=1}, -- shovel
  {itemid=2789, count=100}, -- brown mushrooms
}

local firstItems = {
  { -- SORC ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=2647, count=1}, -- plate legs
    {itemid=2643, count=1}, -- leather boots
    {itemid=2525, count=1}, -- dwarven shield
    {itemid=2191, count=1}, -- wand of dragonbreath


    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7620, count=1}, -- mp
	{itemid=7618, count=1}, -- hp
    {itemid=2293, count=1}, -- mw
	{itemid=2261, count=1}, -- dr
    {itemid=2274, count=1}, -- avalanche rune
	{itemid=2305, count=1}, -- firebomb rune
  },
  { -- DRUID ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=2647, count=1}, -- plate legs
    {itemid=2643, count=1}, -- leather boots
    {itemid=2525, count=1}, -- dwarven shield
    {itemid=2186, count=1}, -- moonlight rod 

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7620, count=1}, -- mp
	{itemid=7618, count=1}, -- hp
    {itemid=2293, count=1}, -- mw
	{itemid=2261, count=1}, -- dr
    {itemid=2269, count=1}, -- wg
    {itemid=2274, count=1}, -- avalanche rune
	{itemid=2305, count=1}, -- firebomb rune
  },
  { -- PALADIN ITEMS
    {itemid=2457, count=1}, -- steel helemet
    {itemid=8891, count=1}, -- belted cape
    {itemid=2647, count=1}, -- plate legs
    {itemid=2643, count=1}, -- leather boots
    {itemid=2525, count=1}, -- dwarven shield
    {itemid=7368, count=1}, -- assassin stars

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7620, count=1}, -- mp
	{itemid=7618, count=1}, -- hp
    {itemid=2293, count=1}, -- mw
	{itemid=2261, count=1}, -- dr
	{itemid=2305, count=1}, -- firebomb rune
	{itemid=2274, count=1}, -- avalanche rune
  },
  { -- KNIGHT ITEMS
    {itemid=2457, count=1}, -- steel helemet
    {itemid=2463, count=1}, -- plate armor
    {itemid=2647, count=1}, -- plate legs
    {itemid=2643, count=1}, -- leather boots
    {itemid=2525, count=1}, -- dwarven shield
    {itemid=10313, count=1}, -- Incredible Mumpiz Slayer

	{itemid=2273, count=1}, -- uh
    {itemid=7620, count=1}, -- mp
	{itemid=7618, count=1}, -- hp
    {itemid=2293, count=1}, -- mw
	{itemid=2261, count=1}, -- dr
	{itemid=2305, count=1}, -- firebomb rune
	{itemid=2274, count=1}, -- avalanche rune

  }
}

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 recieved your first items!")
      end
      setPlayerStorageValue(cid, 67708, 1)
    end
  end
  return TRUE
end
:D

- - - Updated - - -

Please answear :((
 
Last edited by a moderator:
I reead your script and see not are any mod so you have in
creaturescripts.xml
this:
LUA:
<event type="login" name="firstitems" event="script" value="firstitems.lua"/>
data/creaturescripts/scripts in your login.lua
have this:
LUA:
registerCreatureEvent(cid, "Firstitems")
script edit , try this:
LUA:
local firstItems_storage = 30001

local commonItems = {
	{itemid=2554, inContainer = TRUE}, -- shovel
	{itemid=2120, inContainer = TRUE}, -- rope
	{itemid=2152, count=20, inContainer = TRUE}, -- 2 crystal coins
	{itemid=2789, count=20, inContainer = TRUE}, -- brown mushrom
	{itemid=2643} -- leather boots
}
local firstItems = {
	{ -- Sorcerer 
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2323}, 
		{itemid=8871}, 
		{itemid=2647}, 
		{itemid=2643}, 
		{itemid=2525},
		{itemid=2268}, 
		{itemid=2273}, 
		{itemid=7620}, 
		{itemid=7618}, 
        {itemid=2293}, 
		{itemid=2261}, 
		{itemid=2274}, 
		{itemid=2305} 
		{itemid=2186} 
	},
	{ -- Druid
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2323}, 
		{itemid=8871}, 
		{itemid=2647}, 
		{itemid=2643}, 
		{itemid=2525},
		{itemid=2268}, 
		{itemid=2273}, 
		{itemid=7620}, 
		{itemid=7618}, 
        {itemid=2293}, 
		{itemid=2261}, 
		{itemid=2274}, 
		{itemid=2305} 
		{itemid=2191}
	},
	{ -- Paladin
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2457}, 
		{itemid=8891}, 
		{itemid=2647}, 
		{itemid=2643}, 
		{itemid=2525},
		{itemid=7368}, 
		{itemid=2268}, 
		{itemid=2273}, 
		{itemid=7620}, 
        {itemid=7618}, 
		{itemid=2293}, 
		{itemid=2261}, 
		{itemid=2305}, 
		{itemid=2191}
	},
	{ -- Knight
		{itemid=1988, container = TRUE}, -- backpack
		{itemid=2463, inContainer = TRUE}, -- daramanian mace
		{itemid=8601, inContainer = TRUE}, -- steel axe
		{itemid=2457},
		{itemid=2647}, 
		{itemid=2643}, 
		{itemid=2525}, 
		{itemid=10313}, 
		{itemid=2273},
		{itemid=7620}, 
		{itemid=7618}, 
		{itemid=2293},
        {itemid=2261}, 
		{itemid=2305}, 
		{itemid=2478}
	}
}

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 and getPlayerStorageValue(cid, firstItems_storage) <= 0 then
		local currvoc = getPlayerVocation(cid)
		local vocation = 5 > currvoc and currvoc or currvoc - 4
		local giveItems = firstItems[vocation]
	if giveItems then
		for _, v in ipairs(giveItems) do
	if v.container == TRUE then
		backpack = doPlayerAddItem(cid, v.itemid, 1)
	elseif v.inContainer == TRUE then
		doAddContainerItem(backpack, v.itemid, v.count or 1)
	else
		doPlayerAddItem(cid, v.itemid, v.count or 1)
		end
	end
end
setPlayerStorageValue(cid, firstItems_storage, 1)
end
return TRUE
end
and i see you edit script but bad.. you in end not have close this ,example:
you have this
Code:
  { -- KNIGHT ITEMS
    {itemid=2457, count=1}, -- steel helemet
    {itemid=2463, count=1}, -- plate armor
    {itemid=2647, count=1}, -- plate legs
    {itemid=2643, count=1}, -- leather boots
    {itemid=2525, count=1}, -- dwarven shield
    {itemid=10313, count=1}, -- Incredible Mumpiz Slayer
 
	{itemid=2273, count=1}, -- uh
    {itemid=7620, count=1}, -- mp
	{itemid=7618, count=1}, -- hp
    {itemid=2293, count=1}, -- mw
	{itemid=2261, count=1}, -- dr
	{itemid=2305, count=1}, -- firebomb rune
	[FONT=Arial Black][COLOR="#FF0000"]{itemid=2274, count=1},[/COLOR][/FONT] -- avalanche rune
you don't close ,
need put this:
Code:
	{itemid=2305, count=1}, -- firebomb rune
	[FONT=Arial Black][COLOR="#FF0000"]{itemid=2274, count=1}[/COLOR][/FONT] -- avalanche rune
you use }, on finish script local so you no need close.. read script and u understand
 
Last edited:
When i add <event type="login" name="firstitems" event="script" value="firstitems.lua"/> in creature.xml and registerCreatureEvent(cid, "Firstitems") this in creature/script/login.config cant i start the sever its comes up ERROR: Unable to load CreatureEvents!
 
Don't register login scripts in login.lua.
And post your creaturescripts.xml for the error.
Also post other errors if you have them.
 
This scripts do i got in my creatyrescripts.xml

<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="MageBomb" event="script" value="anti.lua"/>
<event type="kill" name="skulls" event="script" value="skulls.lua"/>
<event type="look" name="FragsL" event="script" value="seefrags.lua"/>
<event type="advance" name="Addons" event="script" value="Addons.lua"/>

<event type="login" name="StartSkills" event="script" value="startskills.lua"/>
<event type="login" name="Lowlevellock" event="script" value="lowlevellock.lua"/>
<!--event type="death" name="FragReward" event="script" value="fragreward.lua"/-->
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>

<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
<event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>

<event type="think" name="Idle" event="script" value="idle.lua"/>
<!--event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/-->
</creaturescripts>
<event type="login" name="firstitems" event="script" value="firstitems.lua"/> registerCreatureEvent(cid, "Firstitems")
 
Add that line above </creaturescripts>, you can't add lines under it.
XML:
<event type="login" name="firstitems" event="script" value="firstitems.lua"/>

And remove this: registerCreatureEvent(cid, "Firstitems")
 
You don't put this: registerCreatureEvent(cid, "Firstitems")
in your creaturescripts.xml
Just only need this in your creaturescripts.xml
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="MageBomb" event="script" value="anti.lua"/>
<event type="kill" name="skulls" event="script" value="skulls.lua"/>
<event type="look" name="FragsL" event="script" value="seefrags.lua"/>
<event type="advance" name="Addons" event="script" value="Addons.lua"/>
<event type="login" name="StartSkills" event="script" value="startskills.lua"/>
<event type="login" name="Lowlevellock" event="script" value="lowlevellock.lua"/>
<event type="login" name="firstitems" event="script" value="firstitems.lua"/>
	
<!--event type="death" name="FragReward" event="script" value="fragreward.lua"/-->
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
<event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
<event type="think" name="Idle" event="script" value="idle.lua"/>
</creaturescripts>

and open your data/creaturescripts/scripts open file login.lua
and search:
LUA:
registerCreatureEvent(cid, "AdvanceSave")
and remplacE: example..

LUA:
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "firstitems")
 
I ended my war server i did a evolution server insted.

- - - Updated - - -

is this script good for first items or did i do somthing wrong?
LUA:
local firstItems = {}
firstItems[0] =
{
2173,
2457,
2463,
2647,
7457,
2516,
2168,
2190
}
firstItems[1] =
{
2173,
2457,
2463,
2647,
7457,
2516,
2168,
2190
}
firstItems[2] =
{
2173,
2457,
2463,
2647,
7457,
2516,
2168,
2182
}
firstItems[3] =
{
2173,
2457,
2463,
2647,
7457,
2516,
2168,
2389
}
firstItems[4] =
{
2173,
2457,
2463,
2647,
7457,
2516,
2168,
2392
}

function onLogin(cid)
if getPlayerStorageValue(cid, 30001) == -1 then
for i = 1, table.maxn(firstItems[getPlayerVocation(cid)]) do
doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)][i], 1)
end
if getPlayerSex(cid) == 0 then
doPlayerAddItem(cid, 2463, 1)
else
doPlayerAddItem(cid, 2463, 1)
end
local bag = doPlayerAddItem(cid, 2003, 1)
doAddContainerItem(bag, 2160, 2)
doAddContainerItem(bag, 7618, 30)
doAddContainerItem(bag, 7620, 30)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2173, 1)
setPlayerStorageValue(cid, 30001, 1)
end
return TRUE
end
 
Last edited by a moderator:
Back
Top