• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Get honor when kills player

Bassam421

Lockout RPG/PVP Owner
Joined
Nov 8, 2008
Messages
359
Reaction score
7
Location
Sweden , Göteborg
Hello guys i have a small request, i want a script that does if u kill a player, u will receive one of his honor points,
and the player who dies will lose one.


I would be very grateful if u could help me with this one!


Thank you in advance! <3
 
Sorry can't help you since im not a scripter buy I just had so say this:

Freaking awesome idea with rating system in Tibia :D
 
When he reached 0 he will either buy a item from donation shop, that isnt so expensive, and when a player gets like 200 points he get's acces to certain spawns, items, spell etc. So my server is going to be pvp based BUT also an RPG :D but i havent thinking on the effect when the player dies ...
 
Last edited:
Thank you! I'm working on more awesome idés i have found alot of usefulls script, and i will make sure to use them. I really hopes to that someone can help with
this script! Well thanks anyway for opinion :)
 
I have a script.. mayby someone can rebuild this script or some think..
LUA:
function onKill(cid, target, lastHit)
	if cid ~= target and isPlayer(target) then
		if getPlayerIp(cid) == getPlayerIp(target) then
			doCreatureAddHealth(cid, -500)
			doCreatureAddMana(cid, -500)
		else
											--doPlayerAddExp(cid, (getPlayerExperience(target)/95))
			doPlayerAddItem(cid, 9696, 1)
		end
	end
	return true
end

This will always give the player a item.. but it needs to give him points ofc, and remove it from the other player..:P

I don't know if this helps some one.. but it was a try!


Pasibun
 
Hmm looks good, maybe if i just change in it a bit, what about when u look on a player it will say how much honor he has? and how will the script write it down to the database?

- - - Updated - - -

maybe we can try to change in addplayeritem, to addplayerstorage?

- - - Updated - - -

function onKill(cid, target, lastHit)
if cid ~= target and isPlayer(target) then
if getPlayerIp(cid) == getPlayerIp(target) then
doCreatureAddHealth(cid, -500)
doCreatureAddMana(cid, -500)
else
--doPlayerAddstorage(cid, (getPlayerstorage(target)/1))
doPlayerAddstorage(cid, xxxx, 1)
end
end
return true
end
 
Good idea...

LUA:
		function onLook(cid, thing, position, lookDistance)
			if(isPlayer(thing.uid)) then
				local rank = {rank = "Private", frags = 0}
				for k, v in pairs(titles) do
					if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
						if(k - 1 > rank.frags) then
									rank.rank, rank.frags = v, k - 1
						end
					end
				end
				doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank)
			end
			return true
		end

This script is from a mod.. i use it in my server it called ranks.. players get a rank when killing players.. but it also had a function onlook..
Here it will show you what rank the player is.. but mayby we can change it to the honour..
I guess we need to create a new kind of storage.. like VIP points..
 
Good idea...

LUA:
			<event type = "look" name = "ranksLook" event = "script"><=!=[=C=D=A=T=A=[
				domodlib("ranks")
				function onLook(cid, thing, position, lookDistance)
					if(isPlayer(thing.uid)) then
						local rank = {rank = "Private", frags = 0}
						for k, v in pairs(titles) do
							if(math.max(0, getPlayerStorageValue(thing.uid, fragsStorage)) > k - 1) then
								if(k - 1 > rank.frags) then
									rank.rank, rank.frags = v, k - 1
								end
							end
						end
						doPlayerSetSpecialDescription(thing.uid, "\n Military rank: " .. rank.rank)
					end
					return true
				end
			]=]=></event>

This script is from a mod.. i use it in my server it called ranks.. players get a rank when killing players.. but it also had a function onlook..
Here it will show you what rank the player is.. but mayby we can change it to the honour..
I guess we need to create a new kind of storage.. like VIP points..

omg i love you! yeah i guess it's easy to change it to honor, so we can use like the vippoints storage for the honor storage?
 
i now have v5 :D, what about this script?
local block_kills_acc = {}
local block_kills_ip = {}
local max_kills_per_target_account = 3
local max_kills_per_target_ip = 5

function onKill(cid, target)
if(isPlayer(target)) then
if(block_kills_acc[getPlayerGUID(cid)] == nil) then
block_kills_acc[getPlayerGUID(cid)] = {}
end
if(block_kills_acc[getPlayerGUID(cid)][getPlayerAccountId(target)] == nil) then
block_kills_acc[getPlayerGUID(cid)][getPlayerAccountId(target)] = 0
end
block_kills_acc[getPlayerGUID(cid)][getPlayerAccountId(target)] = block_kills_acc[getPlayerGUID(cid)][getPlayerAccountId(target)] + 1
if(block_kills_ip[getPlayerGUID(cid)] == nil) then
block_kills_ip[getPlayerGUID(cid)] = {}
end
if(block_kills_ip[getPlayerGUID(cid)][getPlayerIp(target)] == nil) then
block_kills_ip[getPlayerGUID(cid)][getPlayerIp(target)] = 0
end
block_kills_ip[getPlayerGUID(cid)][getPlayerIp(target)] = block_kills_ip[getPlayerGUID(cid)][getPlayerIp(target)] + 1
if(block_kills_acc[getPlayerGUID(cid)][getPlayerAccountId(target)] <= max_kills_per_target_account and block_kills_ip[getPlayerGUID(cid)][getPlayerIp(target)] <= max_kills_per_target_ip) then
doPlayerAddItem(cid,2152,20)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You have Owned " .. getCreatureName(target) .. ". You get 2k.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You killed " .. getCreatureName(target) .. " too many times. NO REWARD!")
end
end
return TRUE
end
 
I don't know if this will work but i give it a try.
if there is any errors post it here.
LUA:
function onKill(cid, target, lastHit)
	if cid ~= target and isPlayer(target) then
	          setPlayerStorageValue(cid, 1212, getPlayerStorageValue(cid, 1212)+1)
		  setPlayerStorageValue(target, 1212, getPlayerStorageValue(cid, 1212)-1)
		  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained 1 honor point you got "..getPlayerStorageValue(cid, 1212).." points")
		  end
	return true
end
 
okey now i just need a onlook function script to show the honor,when i kill a player nothing happens :(

Code:
function getAccountPoints(cid)
    local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
    if(res:getID() == -1) then
       return false
    end
    local ret = res:getDataInt("premium_points")
    res:free()
    return tonumber(ret)
end
 
function doAccountAddPoints(cid, count)
    return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) + count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
end
 
function doAccountRemovePoints(cid, count)
    return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
end
can't we change this one to?? to take from getplayerstorage 1212(cid) -1

- - - Updated - - -

bump

- - - Updated - - -

okey now i just need a onlook function script to show the honor,when i kill a player nothing happens :(

Code:
function getAccountPoints(cid)
    local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
    if(res:getID() == -1) then
       return false
    end
    local ret = res:getDataInt("premium_points")
    res:free()
    return tonumber(ret)
end
 
function doAccountAddPoints(cid, count)
    return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) + count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
end
 
function doAccountRemovePoints(cid, count)
    return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
end
can't we change this one to?? to take from getplayerstorage 1212(cid) -1

- - - Updated - - -

bump


buummmmmmmmp
 
Last edited:
Back
Top