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

{Request} Player Kills Counter Storage ID

Nevalopo

Demigod
Joined
Jul 21, 2008
Messages
5,165
Reaction score
68
Location
Sweden, Landskrona
Hello! Im here to request a player-kills-counter.

Every player that you kill should be registrered and saved in a storage id.. If anyone can make it. Ill be happy. Here is something i found from roxxor ot. Made for creatures but can maybe be changed? :)

Code:
local monsters = {
	--name = storage
	["rat"] = 35001,
	["troll"] = 35002,
	["rotworm"] = 35003,
	["dragon"] = 35004,
	["dragon lord"] = 35005,
	["demon"] = 35006,
}

function onKill(cid, target)
	if(isMonster(target) == TRUE) then
		local name = getCreatureName(target)
		local monster = monsters[string.lower(name)]
		if(monster) then
			local killedMonsters = getPlayerStorageValue(cid, monster)
			if(killedMonsters == -1) then
				killedMonsters = 1
			end
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " " .. name .. "'s.")
			setPlayerStorageValue(cid, monster, killedMonsters + 1)
		end
	end
	return TRUE
end
 
Lua:
function onKill(cid, target)
	if(isPlayer(target) == TRUE) then
		if(killed == -1) then
			killed = 1
			end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killed .. " playerss.")
	setPlayerStorageValue(cid, hereputstorage, killed + 1)
		end
	end
	return TRUE
end
sth like this, not tested
hereputstorage change for storagevalue number you want to use and should work
 
Hmm... Let's see if i did correct.

I make kills.lua in data\creaturescripts\scripts
and add this into it.
Code:
  function onKill(cid, target)
        if(isPlayer(target) == TRUE) then
                if(killed == -1) then
                        killed = 1
                        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killed .. " playerss.")
        setPlayerStorageValue(cid, 13379, killed + 1)
                end
        end
        return TRUE
end

I add registerCreatureEvent(cid, "kills") to login.lua

And put <event type="kill" name="kills" script="kills.lua"/>
to data\creaturescripts\creaturescripts.xml

This is what i did.. I get nothing :S
 
Add
Code:
local killed=13379
before function in this script, maybe its the problem
I missed that, but in original the killedMonsters is = storage from config for that monster, I was wondering where killed is declared but you know... ;d
 
Code:
local storage = 13379
function onKill(cid, target)
	if(isPlayer(target) == TRUE) then
		local ns = getPlayerStorageValue(cid, storage)
		local ns = ns < 1 and 1 or ns + 1
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. ns .. " players.")
		setPlayerStorageValue(cid, storage, ns)
	end
	return TRUE
end
 
I never said you released any scripts man :blink:

I ment "scripts" overall (i.e this, this, this, this, etc:p), since on like 70% of the threads I go into I see you rewriting others's scripts to "very short" scripts lol, just like Chojrak does too. Or just answering someone's request, or optimizing one, etc.. those are scripts too right? :rolleyes: I just like seeing people shortening scripts :D

PD: Id be grateful if you could explain us the meaning of those ns > 1 <+)nsnns=1oneone stuff from that script :D

PD2: Dont worry, I dont really kiss the screen if thats whats worrying you lol
 
Last edited:
Back
Top Bottom