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

CreatureEvent Some scripts you need to open a War Server

Vote the city for war server


  • Total voters
    192

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
i42228_feature.jpg
Changes in sources to a good Hardcore/War Server
-----------------------------------------------------------------------
Player receive reward for frags and skull when reach X kills(not frags)
Lua:
function onKill(cid, target, lastHit)
	if cid ~= target and isPlayer(target) then
		if getPlayerIp(cid) == getPlayerIp(target) then
			doCreatureAddHealth(cid, -200)
			doCreatureAddMana(cid, -200)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been punished for killing a player of the same IP.')
		else
			doPlayerAddItem(cid, 2152, 1)
			setPlayerStorageValue(cid, 6776, getCreatureStorage(cid, 6776) + 1)
		end
	end

	if(getPlayerStorageValue(cid, 6776) == 5) and getCreatureStorage(cid, 6001) == -1 then
		broadcastMessage(getCreatureName(cid) .. " is on killing spree! He killed 5 players!")
		setPlayerStorageValue(cid, 6001, 1)
		doCreatureSetSkullType(cid, 3)  -- 3 is white

	elseif(getPlayerStorageValue(cid, 6776) == 10) and getCreatureStorage(cid, 6002) == -1 then
		broadcastMessage(getCreatureName(cid) .. " is dominating! He killed 10 players!")
		setPlayerStorageValue(cid, 6002, 1)
		doCreatureSetSkullType(cid, 4)  -- 3 is red

	elseif(getPlayerStorageValue(cid, 6776) == 25) and getCreatureStorage(cid, 6003) == -1 then
		broadcastMessage(getCreatureName(cid) .. " is CRAZY! He killed 25 players!")
		setPlayerStorageValue(cid, 6003, 1)
		doCreatureSetSkullType(cid, 5)  -- 5 is black

	elseif(getPlayerStorageValue(cid, 6776) == 50) and getCreatureStorage(cid, 6004) == -1 then
		broadcastMessage(getCreatureName(cid) .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
		setPlayerStorageValue(cid, 6004, 1)
		doPlayerAddItem(cid, 2640, 1)  -- soft boots as reward for killing 50 players

	elseif(getPlayerStorageValue(cid, 6776) == 100) and getCreatureStorage(cid, 6005) == -1 then
		broadcastMessage("Bow down to your new god! " ..getCreatureName(cid).. " has 100 frags!")
		setPlayerStorageValue(cid, 6005, 1)
		doPlayerAddItem(cid, 8266, 1)  -- kosheis amulet as reward for killing 100 players

	elseif(getPlayerStorageValue(cid, 6776) == 150) and getCreatureStorage(cid, 6006) == -1 then
		broadcastMessage(getCreatureName(cid) .. " is not a human! He killed 150 players!")
		setPlayerStorageValue(cid, 6006, 1)
		doPlayerAddItem(cid, 9932, 1)  -- firewalker boots as reward for killing 150 players
	return true
end
-----------------------------------------------------------------------


Player in guild receive 5% extra exp
By Summ
Lua:
function onLogin(cid)

local gid = getPlayerGuildId(cid)
if gid ~= 0 then
local ex = getPlayerRates(cid)[SKILL__LEVEL]
doPlayerSetRate(cid, SKILL__LEVEL, (ex+0.05))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received 5% extra experience for being in a guild.")
		end
	return true
end


When player logout he loses his frags and get teleported to temple
Made by me and someone else helped me with db.executeQuery(If you helped me pm me)
Lua:
function onLogout(cid)
	if getPlayerLevel(cid) < 150 then
                doPlayerAddExperience(cid, (getExperienceForLevel(150) - getPlayerExperience(cid)))
		db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	end
     return true
end

Anti-MC/Magebomb
Bogart posted in forum
Lua:
local config = {
	max = 1,     -- max chars with the same ip
	text = "Multi-Client is not allowed.",  -- text on kick
	group_id = 1 -- only kick player with group id 1 (normal players)
}
 
local accepted_ip_list = {} -- list of ip's then can use MC
 
local function antiMC(p)
	if #getPlayersByIp(getPlayerIp(p.pid)) >= p.max then
        	doRemoveCreature(p.pid)
	end
	return TRUE
end
 
function onLogin(cid)
	if getPlayerGroupId(cid) <= config.group_id then
		if isInArray(accepted_ip_list,getPlayerIp(cid)) == FALSE then 
			addEvent(antiMC, 2000, {pid = cid, max = config.max+1})
			doPlayerSendTextMessage(0, cid, 22, "Multi-Client is not allowed.")
		end
	end
	return TRUE
end

Frags on look
When I found this script it contains "--Script By Theax"
Lua:
--Script By Theax ""
function getPlayerFrags(cid)
    local time = os.time()
    local times = {today = (time - 86400), week = (time - (7 * 86400))}
 
    local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
    if(result:getID() ~= -1) then
        repeat
            local content = {date = result:getDataInt("date")}
            if(content.date > times.today) then
                table.insert(contents.day, content)
            elseif(content.date > times.week) then
                table.insert(contents.week, content)
            else
                table.insert(contents.month, content)
            end
        until not result:next()
        result:free()
    end
 
    local size = {
        day = table.maxn(contents.day),
        week = table.maxn(contents.week),
        month = table.maxn(contents.month)
    } 
    return size.day + size.week + size.month
end 
 
function onLogin(cid)
    registerCreatureEvent(cid, "fraglook")
    return true
end
 
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerFrags(thing.uid)..']')
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..']')
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'.'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''
 
        if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
            string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
        end
 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
            string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
        end 
 
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
            string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
            string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
        end
 
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
            string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
        return false
    end
    return true
end

Reward for killing player, no reward to same iP
Found this script here
Lua:
function onKill(cid, target, lastHit)
	if cid ~= target and isPlayer(target) then
		if getPlayerIp(cid) == getPlayerIp(target) then
			doCreatureAddHealth(cid, -200)
			doCreatureAddMana(cid, -200)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been punished for killing a player of the same IP.')
		else
			doPlayerAddItem(cid, 2152, 1)
			setPlayerStorageValue(cid, 6776, getCreatureStorage(cid, 6776) + 1)
		end
	end
	return true
end

Players receive bless onlogin
I made this, I think, don't remember.
Lua:
function onLogin(cid)
 
	if isPlayer(cid) then
			doPlayerAddBlessing(cid, 1)
			doPlayerAddBlessing(cid, 2)
			doPlayerAddBlessing(cid, 3)
			doPlayerAddBlessing(cid, 4)
			doPlayerAddBlessing(cid, 5)	
 	end
 
	return true
end

If player is vip and less than level 150 he receive level 160 onlogin. If player without vip login less than level 150 he receive 150 (Vip system by mock)
Found this here
Lua:
function onLogin(cid)

local setPlayerLevelOnLogin = 150
local setPlayerLevelOnLoginVIP = 160

	if(getPlayerLevel(cid) < 150) and vip.getVip(cid) >= 1 then
		doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLoginVIP) - getPlayerExperience(cid)))
		doPlayerSendTextMessage(0, cid, 22, "Go kill someone!")
	else
		doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
		doPlayerSendTextMessage(0, cid, 22, "Go kill someone!")
	end
	return TRUE
end

Change Map
Found it in another forum
Lua:
local config, new = {
	minTownId = 1,
	maxTownId = 3
}, 0
function onThink(interval, lastExecution)
	for _, pid in ipairs(getPlayersOnline()) do
		local town = getPlayerTown(pid)
		new = town < config.maxTownId and town + 1 or config.minTownId
		doPlayerSetTown(pid, new)
		doTeleportThing(pid, getTownTemplePosition(new))
		doRemoveCondition(pid, CONDITION_INFIGHT)
		doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
		doCreatureAddMana(pid, getCreatureMaxMana(pid))
	end
	db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
	doBroadcastMessage("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
	return true
end

You must add this scripts in creaturescripts.xml/login.lua/globalevents.xml
 
Last edited:
Nice, dude! But can you do a script with skulls? I mean, when you have 4 frags (killstreak) you recieve White skull, when you have 10 frags (killstreaK) you recieve a Red skull?
 
Frags on look
Lua:
--Script By Theax ""
function getPlayerFrags(cid)
    local time = os.time()
    local times = {today = (time - 86400), week = (time - (7 * 86400))}
 
    local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
    if(result:getID() ~= -1) then
        repeat
            local content = {date = result:getDataInt("date")}
            if(content.date > times.today) then
                table.insert(contents.day, content)
            elseif(content.date > times.week) then
                table.insert(contents.week, content)
            else
                table.insert(contents.month, content)
            end
        until not result:next()
        result:free()
    end
 
    local size = {
        day = table.maxn(contents.day),
        week = table.maxn(contents.week),
        month = table.maxn(contents.month)
    } 
    return size.day + size.week + size.month
end 
 
function onLogin(cid)
    registerCreatureEvent(cid, "fraglook")
    return true
end
 
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerFrags(thing.uid)..']')
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..']')
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'.'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''
 
        if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
            string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
        end
 
        if getPlayerGuildId(cid) > 0 then 
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
            string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
        end 
 
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
            string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
            string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
        end
 
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
            string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
        return false
    end
    return true
end
Credits to me <_<

And change those
Lua:
'n'

to
Lua:
'\n'
 
Last edited:
thoose all scripts have been done in support section... the authors should release it in my opinion...
 
You could at least give credits lol and please don't fuck up the tabbing..
Player in guild receive 5% extra exp
(This script must be optimized: Guild members will receive only if 5+ members be online)
Lua:
function onLogin(cid)
	local gid = getPlayerGuildId(cid)
	if gid ~= 0 then
		local ex = getPlayerRates(cid)[SKILL__LEVEL]
		doPlayerSetRate(cid, SKILL__LEVEL, (ex+0.05))
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received 5% extra experience for being in a guild.")
	end
	return true
end
 
Script 'Skulls with frags' don't work. No errors, but character don't die - It's standing with no HP bar and name.
 
These scripts are working 100% without problem.

Tested in dev 0.4 rev 3884. Are you using 0.3.6?
 
Hello! I need little help with this script:
Lua:
local levels = {
	[1] = {health = 845, mana = 3995, cap = 1790},
	[2] = {health = 845, mana = 3995, cap = 1790},
	[3] = {health = 1505, mana = 2015, cap = 3110},
	[4] = {health = 2165, mana = 695, cap = 3770},
	[5] = {health = 845, mana = 3995, cap = 1790},
	[6] = {health = 845, mana = 3995, cap = 1790},
	[7] = {health = 1505, mana = 2015, cap = 3110},
	[8] = {health = 2165, mana = 695, cap = 3770}
}
local level, experience = 140, 43812800

function onLogout(cid)
	local accountManager = getPlayerAccountManager(cid)
	if isPlayer(cid) and accountManager == MANAGER_NONE then
		db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
		db.executeQuery("UPDATE `players` SET `level` = '140', `health` = '".. levels[getPlayerVocation(cid)].health .."', `healthmax` = '".. levels[getPlayerVocation(cid)].health .."', `experience` = '43812800', `mana` = '".. levels[getPlayerVocation(cid)].mana .."', `manamax` = '".. levels[getPlayerVocation(cid)].mana .."', `cap` = '".. levels[getPlayerVocation(cid)].cap .."' WHERE `players`.`id` = ".. getPlayerGUID(cid) ..";")
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	end
	return true
end
If I logout and login I have level, health, mana and cap this same as I have earlier.
 
Hello! I need little help with this script:
Lua:
local levels = {
	[1] = {health = 845, mana = 3995, cap = 1790},
	[2] = {health = 845, mana = 3995, cap = 1790},
	[3] = {health = 1505, mana = 2015, cap = 3110},
	[4] = {health = 2165, mana = 695, cap = 3770},
	[5] = {health = 845, mana = 3995, cap = 1790},
	[6] = {health = 845, mana = 3995, cap = 1790},
	[7] = {health = 1505, mana = 2015, cap = 3110},
	[8] = {health = 2165, mana = 695, cap = 3770}
}
local level, experience = 140, 43812800

function onLogout(cid)
	local accountManager = getPlayerAccountManager(cid)
	if isPlayer(cid) and accountManager == MANAGER_NONE then
		db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
		db.executeQuery("UPDATE `players` SET `level` = '140', `health` = '".. levels[getPlayerVocation(cid)].health .."', `healthmax` = '".. levels[getPlayerVocation(cid)].health .."', `experience` = '43812800', `mana` = '".. levels[getPlayerVocation(cid)].mana .."', `manamax` = '".. levels[getPlayerVocation(cid)].mana .."', `cap` = '".. levels[getPlayerVocation(cid)].cap .."' WHERE `players`.`id` = ".. getPlayerGUID(cid) ..";")
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	end
	return true
end
If I logout and login I have level, health, mana and cap this same as I have earlier.

It's not a good Idea reset level/health/mana and cap when player login/logout.
Why don't you just set the minimum level? (Example: If player is lower than level 150 he receive level 150 as minimum)


That's right, using 0.3.6
I don't know how 0.3.6 works because I never used :(
 
It's not a good Idea reset level/health/mana and cap when player login/logout.
Why don't you just set the minimum level? (Example: If player is lower than level 150 he receive level 150 as minimum)



I don't know how 0.3.6 works because I never used :(
Yes! That's a good idea, thanks you very much. ;)
 
Back
Top