• 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 Recover skills on enforced

domelxp

Member
Joined
Mar 1, 2010
Messages
243
Reaction score
5
How to change this script
PHP:
function onLogin(cid)
    if getPlayerLevel(cid) < 150 then
        doPlayerAddExperience(cid, getExperienceForLevel(150) - getPlayerExperience(cid))
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You\'ve recovered your lost levels.')
    end
    return true
end
to recover skills
on 3 scripts to diferent vocations or 1 sript to all voc

axe
shielding
magic lvl
for knight
-------------------
shielding
magic lvl
distance fighting
for palladin
--------------
shielding
magic lvl
for sorc and druid
--------

thx for help^_^
 
LUA:
local t = {
	[{1,2,5,6}] = {
		[SKILL_SHIELD] = 22,
		[SKILL__MAGLEVEL] = 75,
	},
	[{3,7}] = {
		[SKILL_SHIELD] = 85,
		[SKILL__MAGLEVEL] = 18,
		[SKILL_DISTANCE] = 85,
	},
	[{4,8}] = {
		[SKILL_SHIELD] = 85,
		[SKILL__MAGLEVEL] = 10,
		[SKILL_AXE] = 85,
	}
}
 
function onLogin(cid)
	if getPlayerLevel(cid) < 150 then
		doPlayerAddExperience(cid, getExperienceForLevel(150) - getPlayerExperience(cid))
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You\'ve recovered your lost levels.')
	end
 
	local v = getPlayerVocation(cid)
	for voc, k in pairs(t) do
		if isInArray(voc, v) then
			for skill, amount in pairs(k) do
				if skill < 7 and getPlayerSkillLevel(cid, skill) < amount then
					for i = 1, amount - getPlayerSkillLevel(cid, skill) do
						doPlayerAddSkill(cid, skill, 1, true)
					end
				elseif skill == 7 and getPlayerMagLevel(cid, true) < amount then
					doPlayerAddMagLevel(cid, amount - getPlayerMagLevel(cid, true))
				elseif skill == 8 and getPlayerLevel(cid) < amount then
					doPlayerAddLevel(cid, amount - getPlayerLevel(cid), true)
				end
			end
			break
		end
	end

	return true
end
 
Last edited:
dont work .... when player die ... only lvl is recover to 150 but skill is not recover
this are skill for vocations
you can try again ?
Knight - axe/shielding/magic lvl 85/85/10
Palladin- distance/shielding/magic lvl 85/85/18
Druid/sorc shielding/magic lvl 22/75
 
Last edited:
Could you make the script advance or downgrade their skills to what the amount is set to? Your script just keeps adding 1 magic level until it reaches the 75 for mages.
 
Alright thats fine, I'll just let skills advance quickly. Now, about the items they start with.. I'd like it to delete their old items and put new items every time they login.

LUA:
local commonItems = {
  -- ITEMS ALL VOCS RECEIVE
  {itemid=2120, count=1}, -- rope
  {itemid=5710, count=1}, -- shovel
  {itemid=2420, count=1}, -- machete
  {itemid=2789, count=10}, -- brown mushrooms
  {itemid=2305, count=1}, -- fire bomb rune
  {itemid=2261, count=1}, -- destroy field rune
}

local firstItems = {
  { -- SORC ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=8902, count=1}, -- spellbook of mind control
    {itemid=2187, count=1}, -- wand of inferno 

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
  },
  { -- DRUID ITEMS
    {itemid=2323, count=1}, -- hat of the mad
    {itemid=8871, count=1}, -- focus cape
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=8902, count=1}, -- spellbook of mind control
    {itemid=2183, count=1}, -- hailstorm rod  

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=7590, count=1}, -- gmp
    {itemid=2293, count=1}, -- mw
    {itemid=2269, count=1}, -- wg
    {itemid=2278, count=1}, -- para
  },
  { -- PALADIN ITEMS
    {itemid=2493, count=1}, -- demon helmet
    {itemid=8891, count=1}, -- paladin armor
    {itemid=7730, count=1}, -- blue legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=2514, count=1}, -- mastermind shield
    {itemid=7368, count=1}, -- assassin stars

    {itemid=2268, count=1}, -- sd
    {itemid=2273, count=1}, -- uh
    {itemid=8472, count=1}, -- gsp
    {itemid=7589, count=1}, -- smp
    {itemid=7588, count=1}, -- shp
    {itemid=2293, count=1}, -- mw
  },
  { -- KNIGHT ITEMS
    {itemid=2493, count=1}, -- demon helmet
    {itemid=2472, count=1}, -- magic plate armor
    {itemid=2470, count=1}, -- golden legs
    {itemid=2195, count=1}, -- boots of haste
    {itemid=2514, count=1}, -- mastermind shield
    {itemid=2400, count=1}, -- magic sword

    {itemid=7620, count=1}, -- mp
    {itemid=7591, count=1}, -- ghp
    {itemid=8473, count=1}, -- uhp
    {itemid=2273, count=1}, -- uh
    {itemid=2293, count=1}, -- mw
  }
}

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

Not sure how to combine it with this.

LUA:
 for i = 1, 10 do
		local v = getPlayerSlotItem(cid, i).uid
		if v > 0 then
			doRemoveItem(v)
		end
	end
 
@Up: Just change the locals?
LUA:
{itemid=2323, count=1}, -- hat of the mad
Change the itemID of of the hat of the mad to the new itemID of the new item that would go instead of hat of the mad
 
LUA:
local commonItems = {
	-- ITEMS ALL VOCS RECEIVE
	{itemid=2120, count=1}, -- rope
	{itemid=5710, count=1}, -- shovel
	{itemid=2420, count=1}, -- machete
	{itemid=2789, count=10}, -- brown mushrooms
	{itemid=2305, count=1}, -- fire bomb rune
	{itemid=2261, count=1}, -- destroy field rune
}

local firstItems = {
{ -- SORC ITEMS
	{itemid=2323, count=1}, -- hat of the mad
	{itemid=8871, count=1}, -- focus cape
	{itemid=7730, count=1}, -- blue legs
	{itemid=2195, count=1}, -- boots of haste
	{itemid=8902, count=1}, -- spellbook of mind control
	{itemid=2187, count=1}, -- wand of inferno 

	{itemid=2268, count=1}, -- sd
	{itemid=2273, count=1}, -- uh
	{itemid=7590, count=1}, -- gmp
	{itemid=2293, count=1}, -- mw
},
{ -- DRUID ITEMS
	{itemid=2323, count=1}, -- hat of the mad
	{itemid=8871, count=1}, -- focus cape
	{itemid=7730, count=1}, -- blue legs
	{itemid=2195, count=1}, -- boots of haste
	{itemid=8902, count=1}, -- spellbook of mind control
	{itemid=2183, count=1}, -- hailstorm rod  

	{itemid=2268, count=1}, -- sd
	{itemid=2273, count=1}, -- uh
	{itemid=7590, count=1}, -- gmp
	{itemid=2293, count=1}, -- mw
	{itemid=2269, count=1}, -- wg
	{itemid=2278, count=1}, -- para
},
{ -- PALADIN ITEMS
	{itemid=2493, count=1}, -- demon helmet
	{itemid=8891, count=1}, -- paladin armor
	{itemid=7730, count=1}, -- blue legs
	{itemid=2195, count=1}, -- boots of haste
	{itemid=2514, count=1}, -- mastermind shield
	{itemid=7368, count=1}, -- assassin stars

	{itemid=2268, count=1}, -- sd
	{itemid=2273, count=1}, -- uh
	{itemid=8472, count=1}, -- gsp
	{itemid=7589, count=1}, -- smp
	{itemid=7588, count=1}, -- shp
	{itemid=2293, count=1}, -- mw
},
{ -- KNIGHT ITEMS
	{itemid=2493, count=1}, -- demon helmet
	{itemid=2472, count=1}, -- magic plate armor
	{itemid=2470, count=1}, -- golden legs
	{itemid=2195, count=1}, -- boots of haste
	{itemid=2514, count=1}, -- mastermind shield
	{itemid=2400, count=1}, -- magic sword

	{itemid=7620, count=1}, -- mp
	{itemid=7591, count=1}, -- ghp
	{itemid=8473, count=1}, -- uhp
	{itemid=2273, count=1}, -- uh
	{itemid=2293, count=1}, -- mw
}
}

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)
			for i = 1, 10 do
				local v = getPlayerSlotItem(cid, i).uid
				if v > 0 then
					doRemoveItem(v)
				end
			end

			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
 
Back
Top