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

RookSystem

StreamSide

Joseluis Gonzalez
Staff member
Support Team
Joined
Aug 31, 2007
Messages
3,608
Solutions
51
Reaction score
1,224
Location
Arica - Chile
Well, with Nahruto help we create a rooksystem, the script is fine but it was an error, we dont know what is the error so i post it :)

Code:
local config =
	{
		levelToRook = 5,
		rookTempleId = 1,
		health = 185,
		mana = 0,
		level = 1,
		minutes = 56,
		vocation = 0
	}

function onDeath(cid, corpse, killer)
	if (getPlayerLevel(cid) - 1) <= config.levelToRook and getPlayerVocation(cid) ~= 0 then
		--Remueve los items.
		for items = 1, 10 do
			local slotItem = getPlayerSlotItem(cid, items)
			if slotItem.itemid ~= 0 then
				doRemoveItem(slotItem.uid)
			end
		end
		--Actualiza los skills
		for SkillID = 1, 7 do
			db.executeQuery("UPDATE `player_skills` SET `value` = '10', `count` = '0' WHERE `player_skills`.`player_id` = '" .. getPlayerGUID(cid) .. "' AND `player_skills`.`skillid` = ".. SkillID .." LIMIT 1;")
		end
		db.executeQuery("UPDATE `players` SET `level` = '1' WHERE `id` = '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
		db.executeQuery("UPDATE `players` SET `maglevel` = '0' WHERE `id` = '" .. getPlayerGUID(cid) .. "' LIMIT 1;")			
		doPlayerSetTown(cid, config.rookTempleId)
		doPlayerSetVocation(cid, config.vocation)
		setCreatureMaxHealth(cid, config.health)
		setCreatureMaxMana(cid, config.mana)
		setCreatureHealth(cid, config.health)
		setCreatureMana(cid, config.mana)
		setPlayerStamina(cid, config.minutes)
		doPlayerAddItem(cid, 1987, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You has been Rooked.")
	end
	return TRUE
end
 
ye it remove all items

look this function in script:
Code:
		for items = 1, 10 do
			local slotItem = getPlayerSlotItem(cid, items)
			if slotItem.itemid ~= 0 then
				doRemoveItem(slotItem.uid)
			end
		end
 
Ok, here is mine:
Code:
function onPrepareDeath(cid, lastHitKiler, mostDamageKiller)

    if getPlayerExperience(cid) <= 1650 and getPlayerVocation(cid) ~= 0 then
        local rookTownID = 1
        local rookedGUID = getPlayerGUID(cid)
        local deathPos = getCreaturePosition(cid)

        for i = 1, 10 do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
        end

        doPlayerAddItem(cid, 2050, 1)
        doPlayerAddItem(cid, 2382, 1)

        if getPlayerSex(cid) == 0 then
            doPlayerAddItem(cid, 2651, 1)
            local pronoun = "She"
        else
            doPlayerAddItem(cid, 2650, 1)
            local pronoun = "He"
        end

        doPlayerSetVocation(cid, 0)
        doPlayerSetTown(cid, rookTownID)
        doTeleportThing(cid, getTownTemplePosition(rookTownID))

        local rookedCorpse = doCreateItemEx(3058)
        doSetItemSpecialDescription(rookedCorpse, "You recognize " .. getCreatureName(cid) .. ". " .. pronoun .. " was killed by " .. getCreatureName(lastHitKiller) .. ".")
        doTileAddItemEx(deathPos, rookedCorpse)
        doRemoveCreature(cid)

        db.executeQuery("UPDATE `players` SET `level` = '1',  `experience` = '0', `health` = '150', `healthmax` = '150', `mana` = '0', `manamax` = '0', `maglevel` = '0', `manaspent` = '0' WHERE `players`.`player_id` = '" .. rookedGUID .. "' LIMIT 1;")
        db.executeQuery("UPDATE `player_skills` SET `value` = '10',  `count` = '0' WHERE `player_skills`.`player_id` = '" .. rookedGUID .. "' LIMIT 7;")

        return FALSE
    else

        return TRUE

    end

end

Btw, I never tested it and actualy the player doesn't die, it just drop an empty corpse ;p
 
Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)

    if getPlayerExperience(cid) <= 1650 and getPlayerVocation(cid) ~= 0 then
        local rookTownID = 1
        local rookedGUID = getPlayerGUID(cid)
        local deathPos = getCreaturePosition(cid)

        for i = 1, 10 do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
        end

        doPlayerAddItem(cid, 2050, 1)
        doPlayerAddItem(cid, 2382, 1)
		doPlayerAddItem(cid, 1987, 1)

        if getPlayerSex(cid) == 0 then
            doPlayerAddItem(cid, 2651, 1)
            local pronoun = "She"
        else
            doPlayerAddItem(cid, 2650, 1)
            local pronoun = "He"
        

        doPlayerSetVocation(cid, 0)
        doPlayerSetTown(cid, rookTownID)
        doTeleportThing(cid, getTownTemplePosition(rookTownID))

        local rookedCorpse = doCreateItemEx(3058)
        doSetItemSpecialDescription(rookedCorpse, "You recognize " .. getCreatureName(cid) .. ". " .. pronoun .. " was killed by " .. getCreatureName(lastHitKiller) .. ".")
        doTileAddItemEx(deathPos, rookedCorpse)
        doRemoveCreature(cid)
		end

        db.executeQuery("UPDATE `players` SET `level` = '1', `experience` = '0', `health` = '150', `healthmax` = '150', `mana` = '0', `manamax` = '0', `maglevel` = '0', `manaspent` = '0' WHERE `players`.`id` = '" .. rookedGUID .. "' LIMIT 1;")
        for SkillID = 1, 7 do
			db.executeQuery("UPDATE `player_skills` SET `value` = '10', `count` = '0' WHERE `player_skills`.`player_id` = '" .. getPlayerGUID(cid) .. "' AND `player_skills`.`skillid` = ".. SkillID .." LIMIT 1;")
		end

        return FALSE
    else

        return TRUE

    end

end

It works 100% :)
 
Last edited:
not 100%, eh? xP

try this:

Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)

    if getPlayerExperience(cid) <= 4620 and getPlayerVocation(cid) ~= 0 then
        local rookTownID = 5
        local rookedGUID = getPlayerGUID(cid)

        for i = 1, 10 do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
        end

        doPlayerAddItem(cid, 2050, 1)
        doPlayerAddItem(cid, 2382, 1)
        doPlayerAddItem(cid, 1987, 1)

        if getPlayerSex(cid) == 0 then
            doPlayerAddItem(cid, 2651, 1)
            local pronoun = "She"
        else
            doPlayerAddItem(cid, 2650, 1)
            local pronoun = "He"
        end

        doPlayerSetVocation(cid, 0)
        doPlayerSetTown(cid, rookTownID)

        local rookedCorpse = doCreateItemEx(3058)
        doSetItemSpecialDescription(rookedCorpse, "You recognize " .. getCreatureName(cid) .. ". " .. pronoun .. " was killed by " .. getCreatureName(lastHitKiller) .. ".")
        doTileAddItemEx(getCreaturePosition(cid), rookedCorpse)

        doTeleportThing(cid, getTownTemplePosition(rookTownID))
        doPlayerPopupFYI(cid, "Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back\ninto the world in exchange for a small sacrifice.\n\nSimply clock 'Ok' to resume your journeys in Tibia!")
        doRemoveCreature(cid)

        db.executeQuery("UPDATE `players` SET `level` = '1',  `experience` = '0', `health` = '150', `healthmax` = '150', `mana` = '0', `manamax` = '0', `maglevel` = '0', `manaspent` = '0', `conditions` = '' WHERE `players`.`id` = '" .. rookedGUID .. "' LIMIT 1;")
        db.executeQuery("UPDATE `player_skills` SET `value` = '10',  `count` = '0' WHERE `player_skills`.`player_id` = '" .. rookedGUID .. "' LIMIT 7;")

        return FALSE
    else

        return TRUE

    end

end
 
Last edited:
this is correct:
Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)

    if getPlayerExperience(cid) <= 4620 and getPlayerVocation(cid) ~= 0 then
        local rookTownID = 5
        local rookedGUID = getPlayerGUID(cid)
        local deathPos = getCreaturePosition(cid)

        for i = 1, 10 do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
        end

        doPlayerAddItem(cid, 2050, 1)
        doPlayerAddItem(cid, 2382, 1)
        doPlayerAddItem(cid, 1987, 1)

        if getPlayerSex(cid) == 0 then
            doPlayerAddItem(cid, 2651, 1)
            local pronoun = "She"
        else
            doPlayerAddItem(cid, 2650, 1)
            local pronoun = "He"
        end

        doPlayerSetVocation(cid, 0)
        doPlayerSetTown(cid, rookTownID)
        doTeleportThing(cid, getTownTemplePosition(rookTownID))

        local rookedCorpse = doCreateItemEx(3058)
        doSetItemSpecialDescription(rookedCorpse, "You recognize " .. getCreatureName(cid) .. ". " .. pronoun .. " was killed by " .. getCreatureName(mostDamageKiller) .. ".")
        doTileAddItemEx(deathPos, rookedCorpse)
        doRemoveCreature(cid)

        db.executeQuery("UPDATE `players` SET `level` = '1',  `experience` = '0', `health` = '150', `healthmax` = '150', `mana` = '0', `manamax` = '0', `maglevel` = '0', `manaspent` = '0' WHERE `players`.`player_id` = '" .. rookedGUID .. "' LIMIT 1;")
        db.executeQuery("UPDATE `player_skills` SET `value` = '10',  `count` = '0' WHERE `player_skills`.`player_id` = '" .. rookedGUID .. "' LIMIT 7;")

        return FALSE
    else

        return TRUE

    end

end
 
Code:
function onPrepareDeath(cid, lastHitKiler, mostDamageKiller)

    if getPlayerExperience(cid) <= 4620 and getPlayerVocation(cid) ~= 0 then
        local rookTownID = 1
        local rookedGUID = getPlayerGUID(cid)
        local deathPos = getCreaturePosition(cid)

        for i = 1, 10 do
            local slotItem = getPlayerSlotItem(cid, i)
            if slotItem.itemid > 0 then
                doRemoveItem(slotItem.uid)
            end
        end

        doPlayerAddItem(cid, 2050, 1)
        doPlayerAddItem(cid, 2382, 1)
        doPlayerAddItem(cid, 1987, 1)
		local rookedCorpse = doCreateItemEx(3058)
        if getPlayerSex(cid) == 0 then
            doPlayerAddItem(cid, 2651, 1)
            local pronoun = "She"
			doSetItemSpecialDescription(rookedCorpse, "You recognize " .. getCreatureName(cid) .. ". " .. pronoun .. " was killed by " .. getCreatureName(mostDamageKiller) .. ".")
            doTileAddItemEx(deathPos, rookedCorpse)
        else
            doPlayerAddItem(cid, 2650, 1)
            local pronoun = "He"
			doSetItemSpecialDescription(rookedCorpse, "You recognize " .. getCreatureName(cid) .. ". " .. pronoun .. " was killed by " .. getCreatureName(mostDamageKiller) .. ".")
			doTileAddItemEx(deathPos, rookedCorpse)
        end
        doPlayerSetVocation(cid, 0)
        doPlayerSetTown(cid, rookTownID)
        doTeleportThing(cid, getTownTemplePosition(rookTownID))

        db.executeQuery("UPDATE `players` SET `level` = '1',  `experience` = '0', `health` = '150', `healthmax` = '150', `mana` = '0', `manamax` = '0', `maglevel` = '0', `manaspent` = '0' WHERE `players`.`id` = '" .. rookedGUID .. "' LIMIT 1;")
        db.executeQuery("UPDATE `player_skills` SET `value` = '10',  `count` = '0' WHERE `player_skills`.`player_id` = '" .. rookedGUID .. "' LIMIT 7;")
 		for c = 1, 2097152 do 
 		doRemoveCondition(cid, c)
 		end
		doPlayerPopupFYI(cid, "Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back\ninto the world in exchange for a small sacrifice.\n\nSimply clock 'Ok' to resume your journeys in Tibia!")
		doRemoveCreature(cid)
        return FALSE
    else

        return TRUE

    end

end

With Nightmare help we do it xd
Test it and rep++ to him and me :D
 
Back
Top