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

[FREE] Slave Ots Free Scripting Service

Slave Ots

LUA Newbie™
Joined
Jan 19, 2012
Messages
114
Reaction score
32
Location
/goto Slave Ots
Hello Otlanders
I've Decided To Start This Thread To Help ppl Whom Just Started In Open-Tibia & Need LUA Scripts
If You Need Any Script/Help Just Post In There.....

[Note]:- Spamming or being not patient ill ignore you!

you are allowed to ask about Actions/Movements/Talkactions/Creaturescripts/GlobalEvents/Spells..

---------------------------------------------------------------------------------------------------------


hope to got REP++ when i help you!

kind regards
Slave Ots
 
try this --.-- XD
Lua:
local level = 717171 -- the min level
function onSay(cid, words, param, channel)
		if(getPlayerLevel(cid) >= level) then
					doCreatureSetStorage(cid, 85987, getCreatureStorage(cid, 85987) == -1 and 1 or getCreatureStorage(cid, 85987) + 1)
					doRemoveCreature(cid)
					db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = 2000, `manamax` = 2000, `promotion` = 0 WHERE `id` ='"..id.."';")
					db.executeQuery("UPDATE `players` SET `name` = '"..getCreatureName(cid).."' WHERE `id` ='"..getPlayerGUID(cid).."';")
				else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need level " .. level .. ".")
end
	return true
end
 
ok

Rebirth king.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth king" script="rebirth.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="1449"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to {reborn}?!"/>
<parameter key="message_farewell" value="Cya later!"/>
</parameters>
</npc>

rebirth.lua

local config = {
price = 0, -- Price of first rebirth
priceIncrease = 0, -- Works as 'price' + current rebirths * priceIncrease.
rebirthLevel = 717171, -- Level for first rebirth.
rebirthIncrease = 0, -- Works as 'rebirthLevel' + current rebirths * rebirthIncrease.
maxRebirths = 10000000, -- Number of times a player can rebirth.
level = 1000, -- The level the player is set to apon rebirth.
healthPercent = 1.00, -- 1.00 = 100%.
health = 100, -- Only used if 'healthPercent' = 0.
manaPercent = 1.00, -- 1.00 = 100%.
mana = 100, -- Only used if 'manaPercent' = 0.
keepSkills = true, -- Wether players keep skills and level apon rebirth.
skillLevel = 10, -- Only used if 'keepSkills' = false.
magicLevel = 0, -- Only used if 'keepSkills' = false.
capacity = 10000, -- The capacity players are set to apon rebirth.
templePos = {x = 2000, y = 2000, z = 7}, -- The place where players reset to should there town id return 0.
storage = 85987 -- Player storage rebirth count is kept on.
}

local focuses = {}
local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end

local function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
end
end
local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
table.remove(focuses, i)
break
end
end
end
local function lookAtFocus()
for i, v in pairs(focuses) do
if(isPlayer(v)) then
doNpcSetCreatureFocus(v)
return
end
end
doNpcSetCreatureFocus(0)
end

function onCreatureDisappear(cid)
if(isFocused(cid)) then
selfSay("Goodbye.")
removeFocus(cid)
end
end

function onCreatureSay(cid, type, msg)
if((msg == "hi") and not (isFocused(cid))) then
selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)
selfSay("I can {rebirth} you!", cid)
addFocus(cid)
status = 1
elseif((isFocused(cid)) and (msg == "rebirth") and (status == 1)) then
if (getCreatureStorage(cid, config.storage) < config.maxRebirths) then
storage = getCreatureStorage(cid, config.storage)
rebirthLevel = config.rebirthLevel + (config.rebirthIncrease * storage)
if (getPlayerLevel(cid) >= rebirthLevel) then
money = config.price + (config.priceIncrease * storage)
if (getPlayerMoney(cid) >= money) then
selfSay("I can rebirth you for " .. money .. " gold.", cid)
selfSay("Do you want me to rebirth you?", cid)
status = 2
else
selfSay("You need at least " .. money .. " gold before you can rebirth.", cid)
status = 1
end
else
selfSay("You need to be at least level " .. rebirthLevel .. " before you can rebirth.", cid)
status = 1
end
else
selfSay("It seems you can not rebirth anymore.", cid)
status = 1
end
elseif((isFocused(cid)) and (msg == "yes") and (status == 2)) then
selfSay("Ok then i will rebirth you.", cid)
selfSay("You will now be logged out.", cid)
doPlayerRemoveMoney(cid, money)
addEvent(doRebirthPlayer, 2000, {cid=cid})
removeFocus(cid)
elseif((isFocused(cid)) and (msg == "no") and (status == 2)) then
selfSay("Maybe one day you will wise up and change your mind!", cid)
status = 1
elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
selfSay("Goodbye!", cid, true)
removeFocus(cid)
end
end

function onPlayerCloseChannel(cid)
if(isFocused(cid)) then
selfSay("Goodbye.")
removeFocus(cid)
end
end

function onThink()
for i, focus in pairs(focuses) do
if(not isCreature(focus)) then
removeFocus(focus)
else
local distance = getDistanceTo(focus) or -1
if((distance > 4) or (distance == -1)) then
selfSay("Goodbye.")
removeFocus(focus)
end
end
end
lookAtFocus()
end

function doRebirthPlayer(cid)
cid = cid.cid
if (cid == nil) then
return true
end

local guid = getPlayerGUID(cid)

if (config.healthPercent > 0) then
health = getCreatureMaxHealth(cid) * config.healthPercent
else
health = config.health
end
if (config.manaPercent > 0) then
mana = getCreatureMaxMana(cid) * config.manaPercent
else
mana = config.mana
end
if (getPlayerTown(cid) > 0) then
pos = getTownTemplePosition(getPlayerTown(cid))
else
pos = config.templePos
end


doCreatureSetStorage(cid, config.storage, getCreatureStorage(cid, config.storage) + 1)
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `players` SET level = " .. config.level .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET cap = " .. config.capacity .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET health = " .. health .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET healthmax = " .. health .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET mana = " .. mana .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET manamax = " .. mana .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posx = " .. pos.x .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posy = " .. pos.y .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posz = " .. pos.z .. " WHERE id = " .. guid .. ";")

if (not config.keepSkills) then
db.executeQuery("UPDATE `players` SET maglevel = " .. config.magicLevel .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `player_skills` SET value = " .. config.skillLevel .. " WHERE id = " .. guid .. ";")
end
return true
end
 
i need mod of change. Something like

changemap in 2 minutes, next map carlin.

Clearly this message is two minutes before map change.

And when change the map

map has been changed, next map in 20 minutes.

Code:
<?xml version="1.0" encoding="utf-8"?>  
<mod name="changemap" version="1.0" author="vodkart" contact="xtibia.com" enabled="yes">  
<config name="map_func"><=!=[=c=d=a=t=a=[  
 
                      info = {  
                      [0] = {x=654,y=847,z=7},
                      [1] = {x=517,y=602,z=7},
                      [2] = {x=552,y=226,z=7},
                      [3] = {x=789,y=308,z=7},
                      [4] = {x=250,y=180,z=7},
                      [5] = {x=413,y=804,z=7},
                      [6] = {x=763,y=550,z=7},
                      [7] = {x=900,y=849,z=7},
                      [8] = {x=920,y=487,z=7}
                        }

                        storage = 50555  
 
]=]=></config> 
<event type="login" name="check map" event="script"><=!=[=c=d=a=t=a=[  
domodlib('map_func')  
        function onlogin(cid) 
        if getglobalstoragevalue(storage) == -1 then 
        setglobalstoragevalue(storage,getglobalstoragevalue(storage)+1)  
        end 
        doteleportthing(cid,info[getglobalstoragevalue(storage)])   
        return true  
end  
]=]=></event> 
        <globalevent name="changemap" interval="1200" event="script"><=!=[=c=d=a=t=a=[  
        domodlib('map_func')  
        function onthink(interval, lastexecution)  
                dobroadcastmessage('el mapa sera cambiado nuevamente en 20 minutos.')
                if getglobalstoragevalue(storage) < 5 then  
                setglobalstoragevalue(storage,getglobalstoragevalue(storage)+1)   
                else  
                setglobalstoragevalue(storage,getglobalstoragevalue(storage)-5)
                end  
                for _, pid in ipairs(getplayersonline()) do
                doremoveconditions(pid, true)   
	dosendmagiceffect(getcreatureposition(pid), 37)
	docreatureaddhealth(pid, getcreaturemaxhealth(pid))
	docreatureaddmana(pid, (getcreaturemaxmana(pid) - getcreaturemana(pid)))
                doteleportthing(pid,info[getglobalstoragevalue(storage)])    
                end   
         return true  
end]=]=></globalevent> 
</mod>


help me x.x
 
[Request]
i need a script that will keep players from getting under lvl 120.
the one i have is when layer logs in they get xx (200) lvl for example and if they get to lvl 250 or so they can log out and log back in and it dont take there lvl away but when they die and relogback in it takes them to lvl 200.. so i need one that will keep players from getting under lvl 120 but when they lvl it saves it and when they die it dont take them back to lvl 120

if no one understood that then add skype i can explain better..

Skype: blazzinn4201

in data / creaturescripts / scripts / create file ; level_advance.lua
Code:
function onThink(cid, interval)
	 for _, name in  ipairs(getOnlinePlayers()) do
			local cid = getPlayerByName(name)
local minlevel = 150 -- if player level is smaller than this. he will get this level
	if  getPlayerLevel(cid) < minlevel then
	local levels = (minlevel - 1) - getPlayerLevel(cid)
	doPlayerAddLevel(cid, levels)
	
	end
	end
	return true
end

in data / creaturescripts / scripts / login.lua add;
Code:
registerCreatureEvent(cid, "level_advance")

in data / creaturescripts / creaturescripts.xml add;
Code:
<event type="think" name="level_advance" event="script" value="level_advance.lua"/>

its working 100% hope you like it

- - - Updated - - -

What do you think about my request, too hard?

Kind Regards,
Eldin.

what iks your rerquest?

- - - Updated - - -

Rebirth king.xml

you still need any help???
 
Looking for advanced paralyze spell:

Player cast spell, and at X tiles (configurable) send magic effect 32,
then if player was on one of that tiles, he gets `doCreatureSetNoMove`, and it dissapears after X secs, so in that 3secs player cannot move, but he can cast spells etc.

Greetings :)
 
my first script should work , try this i dont know if it will work :S
Lua:
local config = {
price = 0, -- Price of first rebirth
priceIncrease = 0, -- Works as 'price' + current rebirths * priceIncrease.
rebirthLevel = 717171, -- Level for first rebirth.
rebirthIncrease = 0, -- Works as 'rebirthLevel' + current rebirths * rebirthIncrease.
maxRebirths = 10000000, -- Number of times a player can rebirth.
level = 1000, -- The level the player is set to apon rebirth.
healthPercent = 1.00, -- 1.00 = 100%.
health = 100, -- Only used if 'healthPercent' = 0.
manaPercent = 1.00, -- 1.00 = 100%.
mana = 100, -- Only used if 'manaPercent' = 0.
keepSkills = true, -- Wether players keep skills and level apon rebirth.
skillLevel = 10, -- Only used if 'keepSkills' = false.
magicLevel = 0, -- Only used if 'keepSkills' = false.
capacity = 10000, -- The capacity players are set to apon rebirth.
templePos = {x = 2000, y = 2000, z = 7}, -- The place where players reset to should there town id return 0.
storage = 85987 -- Player storage rebirth count is kept on.
}
function onSay(cid, words, param, channel)
money = config.price + (config.priceIncrease * storage)
if (getPlayerLevel(cid) >= rebirthLevel) then
if (getPlayerMoney(cid) >= money) then
doPlayerRemoveMoney(cid, money)
addEvent(doRebirthPlayer, 2000, {cid=cid})
function doRebirthPlayer(cid)
cid = cid.cid
if (cid == nil) then
return true
end
local guid = getPlayerGUID(cid)
if (config.healthPercent > 0) then
health = getCreatureMaxHealth(cid) * config.healthPercent
else
health = config.health
end
if (config.manaPercent > 0) then
mana = getCreatureMaxMana(cid) * config.manaPercent
else
mana = config.mana
end
if (getPlayerTown(cid) > 0) then
pos = getTownTemplePosition(getPlayerTown(cid))
else
pos = config.templePos
end
doCreatureSetStorage(cid, config.storage, getCreatureStorage(cid, config.storage) + 1)
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `players` SET level = " .. config.level .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET cap = " .. config.capacity .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET health = " .. health .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET healthmax = " .. health .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET mana = " .. mana .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET manamax = " .. mana .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posx = " .. pos.x .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posy = " .. pos.y .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posz = " .. pos.z .. " WHERE id = " .. guid .. ";")

if (not config.keepSkills) then
db.executeQuery("UPDATE `players` SET maglevel = " .. config.magicLevel .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `player_skills` SET value = " .. config.skillLevel .. " WHERE id = " .. guid .. ";")
end
end
end
return true
end

tell me if it works or no
 
not working

[15/02/2013 20:02:05] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/rebirth.lua:65: 'end' expected (to close 'function' at line 19) near '<eof>'
[15/02/2013 20:02:05] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/rebirth.lua)
[15/02/2013 20:02:05] data/talkactions/scripts/rebirth.lua:65: 'end' expected (to close 'function' at line 19) near '<eof>
 
Looking for advanced paralyze spell:

Player cast spell, and at X tiles (configurable) send magic effect 32,
then if player was on one of that tiles, he gets `doCreatureSetNoMove`, and it dissapears after X secs, so in that 3secs player cannot move, but he can cast spells etc.

Greetings :)

This one
 
is it to hard to make a rebirth so what about you write !toprebirth and you get a list of top 10 players with rebirth like a spell book but rebirth who have the most rebirth thx
 
not working

try this :S
Lua:
local config = {
price = 0, -- Price of first rebirth
priceIncrease = 0, -- Works as 'price' + current rebirths * priceIncrease.
rebirthLevel = 717171, -- Level for first rebirth.
rebirthIncrease = 0, -- Works as 'rebirthLevel' + current rebirths * rebirthIncrease.
maxRebirths = 10000000, -- Number of times a player can rebirth.
level = 1000, -- The level the player is set to apon rebirth.
healthPercent = 1.00, -- 1.00 = 100%.
health = 100, -- Only used if 'healthPercent' = 0.
manaPercent = 1.00, -- 1.00 = 100%.
mana = 100, -- Only used if 'manaPercent' = 0.
keepSkills = true, -- Wether players keep skills and level apon rebirth.
skillLevel = 10, -- Only used if 'keepSkills' = false.
magicLevel = 0, -- Only used if 'keepSkills' = false.
capacity = 10000, -- The capacity players are set to apon rebirth.
templePos = {x = 2000, y = 2000, z = 7}, -- The place where players reset to should there town id return 0.
storage = 85987 -- Player storage rebirth count is kept on.
}
function onSay(cid, words, param, channel)
money = config.price + (config.priceIncrease * storage)
if (getPlayerLevel(cid) >= rebirthLevel) then
if (getPlayerMoney(cid) >= money) then
doPlayerRemoveMoney(cid, money)
addEvent(doRebirthPlayer, 2000, {cid=cid})

function doRebirthPlayer(cid)
cid = cid.cid
if (cid == nil) then
return true
end

local guid = getPlayerGUID(cid)
if (config.healthPercent > 0) then
health = getCreatureMaxHealth(cid) * config.healthPercent
else
health = config.health
if (config.manaPercent > 0) then
mana = getCreatureMaxMana(cid) * config.manaPercent
else
mana = config.mana
if (getPlayerTown(cid) > 0) then
pos = getTownTemplePosition(getPlayerTown(cid))
else
pos = config.templePos
doCreatureSetStorage(cid, config.storage, getCreatureStorage(cid, config.storage) + 1)
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `players` SET level = " .. config.level .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET cap = " .. config.capacity .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET health = " .. health .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET healthmax = " .. health .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET mana = " .. mana .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET manamax = " .. mana .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posx = " .. pos.x .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posy = " .. pos.y .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `players` SET posz = " .. pos.z .. " WHERE id = " .. guid .. ";")
 
if (not config.keepSkills) then
db.executeQuery("UPDATE `players` SET maglevel = " .. config.magicLevel .. " WHERE id = " .. guid .. ";")
db.executeQuery("UPDATE `player_skills` SET value = " .. config.skillLevel .. " WHERE id = " .. guid .. ";")
end
end
end
end
end
end
return true
end
 
16/02/2013 20:27:57] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/rebirth.lua:67: 'end' expected (to close 'function' at line 19) near '<eof>'
[16/02/2013 20:27:57] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/rebirth.lua)
[16/02/2013 20:27:57] data/talkactions/scripts/rebirth.lua:67: 'end' expected (to close 'function' at line 19) near '<eof>'

ok i got new rebirth system so now may work there is no storage only rebirths
so rebirths is vere rebirth is saved in phpmyadmin in player file
 
Last edited:
[15/02/2013 20:02:05] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/rebirth.lua:65: 'end' expected (to close 'function' at line 19) near '<eof>'
[15/02/2013 20:02:05] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/rebirth.lua)
[15/02/2013 20:02:05] data/talkactions/scripts/rebirth.lua:65: 'end' expected (to close 'function' at line 19) near '<eof>
read the error and try to fix..lol
put or remove end from the last lines and reload :D
 
Back
Top