Sir Shutter
Learning LUA
Well, I got a script was working great, suddenly everything it does is 2X, so it was working like when someone create account when he login he advance from level 1 to level 10, and get plate set + 10cc + bp + 3 runes (uh,sd,gfb) + weapon depending on his voc, suddenly it was like he get everything doubled 2 plate set's 6 runes (2sd,2uh,2gfb) 2 weapons , everything doubled, even the level he advanced from 1 to 10 then from 10 to 12 o.0, idk why is that, so i would like to know how to fix it, thanks
here is the script :-
REP++!
here is the script :-
Code:
local commonItems = {
-- ITEMS ALL VOC RECEIVE
{itemid=2457, count=1}, -- demon set (legs, helm, arm)
{itemid=2463, count=1},
{itemid=2647, count=1},
{itemid=2160, count=10},
{itemid=2643, count=1},
{itemid=2661, count=1},
{itemid=2120, count=1},
{itemid=2554, count=1},
{itemid=2671, count=5}
}
local firstItems = {
{ -- SORC ITEMS
{itemid=2190, count=1}, -- wand
{itemid=2525, count=1}, --dwarven shield
{itemid=2268, count=100}, --sd
{itemid=2273, count=100}, --uh
{itemid=2304, count=100} --gfb
},
{ -- DRUID ITEMS
{itemid=2182, count=1}, -- rod
{itemid=2525, count=1}, --dwarven shield
{itemid=2268, count=100}, --sd
{itemid=2273, count=100}, --uh
{itemid=2304, count=100} --gfb
},
{ -- PALADIN ITEMS
{itemid=2455, count=1}, --xbow
{itemid=2543, count=1}, --1 bolt
{itemid=2268, count=100}, --sd
{itemid=2273, count=100}, --uh
{itemid=2304, count=100} --gfb
},
{ -- KNIGHT ITEMS
{itemid=2432, count=1}, -- fire axe O.o
{itemid=2525, count=1}, --dwarven shield
{itemid=2407, count=1}, --bright sword
{itemid=2436, count=1}, --skull staff
{itemid=2273, count=100} --uh
}
}
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, 90808)
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 received your first items depending on your vocation.")
end
doPlayerAddExp(cid, 9300)
setPlayerStorageValue(cid, 90808, 1)
end
end
return TRUE
end
REP++!