Progenosis
Member
- Joined
- Sep 6, 2011
- Messages
- 131
- Reaction score
- 18
I got this script:
But everytime the characters logs in, it receives the first items again. I want that the characer receives the first items once when it's newly created not everytime he logs in, what should I do?
This is the creaturescripts.xml line:
Help please!
Code:
local commonItems = {
-- ITEMS ALL VOCS RECEIVE [COLOR="Lime"]-- all vocs will recive this items[/COLOR]
{itemid=2481, count=1},
{itemid=2465, count=1},
{itemid=2478, count=1},
{itemid=2643, count=1},
{itemid=2120, count=1},
{itemid=2160, count=10},
{itemid=2789, count=100},
}
local firstItems = {
{ -- SORC ITEMS [COLOR="Blue"]--sorc items[/COLOR]
{itemid=2190, count=1},
{itemid=2529, count=1},
},
{ -- DRUID ITEMS [COLOR="Blue"]--druid items[/COLOR]
{itemid=2182, count=1},
{itemid=2529, count=1},
},
{ -- PALADIN ITEMS [COLOR="Blue"]--pala items[/COLOR]
{itemid=2456, count=1},
{itemid=2544, count=100},
},
{ -- KNIGHT ITEMS [COLOR="Blue"]--knight items[/COLOR]
{itemid=2529, count=1},
{itemid=8602, count=1},
{itemid=3966, count=1},
{itemid=8601, count=1},
}
}
for _, items in ipairs(firstItems) do
for _, item in ipairs(commonItems) do
table.insert(items, item)
end
end
function onLogin(cid)
if getPlayerGroupId(cid) < 4 then
local hasReceivedFirstItems = getPlayerStorageValue(cid, 6771408)
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
But everytime the characters logs in, it receives the first items again. I want that the characer receives the first items once when it's newly created not everytime he logs in, what should I do?
This is the creaturescripts.xml line:
Code:
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
Help please!