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

[0.3.6] Problem with easy script.

Dymczas

New Member
Joined
Mar 8, 2009
Messages
105
Reaction score
0
Hello !
I have problem, on every new lvl i get this items.
Script :
PHP:
function onAdvance(cid, type, oldlevel, newlevel)
if (oldlevel ~= newlevel and type == SKILL__LEVEL) then
if (newlevel >= 42 and getPlayerStorageValue(cid, 44563) == -1) then
doPlayerAddItem(cid, 8922, 1)
setPlayerStorageValue(cid, 44564, 1)
doPlayerAddItem(cid, 8910, 1)
setPlayerStorageValue(cid, 44565, 1)
doPlayerAddItem(cid, 2407, 1)
setPlayerStorageValue(cid, 44566, 1)
doPlayerAddItem(cid, 2432, 1)
setPlayerStorageValue(cid, 44567, 1)
doPlayerAddItem(cid, 2436, 1)
setPlayerStorageValue(cid, 44568, 1)
doPlayerAddItem(cid, 7387, 10)
setPlayerStorageValue(cid, 44569, 1)
end
end
return true
end
I want get it only ONE TIME. Could you help me ? :wub:
 
Lua:
local items = {8922, 8910, 2407, 2432, 2436}
function onAdvance(cid, type, oldlevel, newlevel) 
         if (oldlevel ~= newlevel and type == SKILL__LEVEL) then 
            if (newlevel >= 42 and getPlayerStorageValue(cid, 44563) == -1) then
               for s = 1, #items do 
                   doPlayerAddItem(cid, items[s], 1)
               end 
               setPlayerStorageValue(cid, 44563, 1) 
               doPlayerAddItem(cid, 7387, 10)
            end 
         end 
return true 
end
 
@up
lol didn't refresh ;d

@topic
Try:
PHP:
local storages = {44563,44564,44565,44566,44567,44568,44569}
local items = {{8922,1},{8910,1},{2407, 1},{2432, 1},{2436, 1},{7387, 10}}
function onAdvance(cid, type, oldlevel, newlevel)
	if type == SKILL__LEVEL and newlevel >= 42 and getPlayerStorageValue(cid, 44563) == -1 then
		for storage = 1,#storages do
			setPlayerStorageValue(cid, storages[i], 1)
		end
		for item = 1, #items do
			doPlayerAddItem(cid,item[1],item[2])
		end
	end
return true
end
 
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
	local cfg = {
		[[COLOR="Red"]STORAGE[/COLOR]] = {
			[COLOR="Red"]LEVEL[/COLOR], [COLOR="Red"]REWARD[/COLOR], [COLOR="Red"]COUNT[/COLOR], msg = "Congratulations! Here is your reward."
		}
	}
	if skill == SKILL__LEVEL then
		for s, x in pairs(cfg) do
			if newLevel >= x[1] then
				if getPlayerGroupId(cid) < 3 then
					if getPlayerStorageValue(cid, s) < 1 then
						doPlayerAddItem(cid, x[2], x[3] or 1)
						setPlayerStorageValue(cid, s, 1)
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, x.msg)
						break
					end
				end
			end
		end
	end
	
	return true
end
 
Thats not what he wanted -> an advanced script
Why you loop the table-.- Use level as index..
cfg[newLevel]
 
Back
Top