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

Lua Simple script, doesn't work.

Potar

SocialWorld
Senator
Joined
Mar 1, 2009
Messages
1,661
Reaction score
125
Location
Warsaw, Poland
Hello, like in topic...

This is simple script for killing players, when you kill someone you recive reputation "Value of Storage".

I have 2 problems:

1st:
-When i killed player with lvl 201+ (ex. 234) i have got 50 rep,
-When lvl is less than 201 i recived 50+25 reputation (75) not 25...
-When i killed player with lvl 140 i have got 50+25+5 rep (80rep), but not 5 rep.

2nd:
How to use doCreatureSay option for more info?

For example:
"You have added: +"v[2]" Total reputation points: "getCreatureStorage(cid, rep_storage)

LUA:
local rep_storage = 73337 --storagevalue for your rep
local REWARDS = {
    {301, 50}, --everyone higher than level 301 that dies will give 50 rep
    {201, 25}, --everyone higher than level 201 that dies will give 25 rep
    {150, 5} --etc...
}
 
function onKill(cid, target, lastHit)
 
    if isPlayer(cid) then
        local level = getPlayerLevel(target)
        for i, v in ipairs(REWARDS) do
            if v[1] >= level then
                doCreatureSetStorage(cid, rep_storage, getCreatureStorage(cid, rep_storage) + v[2])
		doCreatureSay(cid, v[2], TALKTYPE_ORANGE_1)
            end
        end
    end
 return TRUE
end
 
LUA:
local rep_storage = 73337 --storagevalue for your rep
local REWARDS = {
	{301, 50}, --everyone higher than level 301 that dies will give 50 rep
	{201, 25}, --everyone higher than level 201 that dies will give 25 rep
	{150, 5} --etc...
}

function onKill(cid, target, lastHit)

	if isPlayer(target) then
		local level = getPlayerLevel(target)
		for _, v in ipairs(REWARDS) do
			if v[1] <= level then
				doCreatureSetStorage(cid, rep_storage, getCreatureStorage(cid, rep_storage) + v[2])
				doCreatureSay(cid, "Blabla:v".. v[2] .."pkt.", TALKTYPE_ORANGE_1)
				break
			end
		end
	end
	return true
end
 
Last edited:
LUA:
local rep_storage = 73338 --storagevalue for your rep
local rep_storage2 = 73339 --storagevalue for your rep
local REWARDS = {
	{301, 50}, --everyone higher than level 301 that dies will give 50 rep
	{201, 25}, --everyone higher than level 201 that dies will give 25 rep
	{150, 5} --etc...
}
 
function onKill(cid, target, lastHit)
	if isPlayer(cid) then
		local level = getPlayerLevel(target)
		for _, v in ipairs(REWARDS) do
			if v[1] >= level then
				if getCreatureStorage(cid, rep_storage) == -1 then doCreatureSetStorage(cid, rep_storage, 0) end
				if getCreatureStorage(cid, rep_storage2) == -1 then doCreatureSetStorage(cid, rep_storage2, 0) end
				doCreatureSetStorage(cid, rep_storage, getCreatureStorage(cid, rep_storage) + v[2])
				doCreatureSetStorage(cid, rep_storage2, getCreatureStorage(cid, rep_storage2) + v[2])
				doCreatureSay(cid, "+".. v[2] .." rep. Total: "..getCreatureStorage(cid, rep_storage2).." ("..getCreatureStorage(cid, rep_storage)..")", TALKTYPE_ORANGE_1)
				break
			end
		end
	end
	return true
end

It doesn't work, now i recive only 50 rep per any player 160-270 etc. all players give 50 rep.

But i need for example:
Lvl 301+ = 50 rep
Lvl 201+ = 25 rep
Lvl 151 + = 5 rep

etc.
 
Last edited:
Back
Top