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

Broadcast each kill

Wavoz

Oldschooler
Joined
Jul 10, 2011
Messages
1,021
Reaction score
84
Could someone help me to make this script to count each kill in broadcast, right now it broadcasts when i kill "You have killed a demon" but it would be great if it broadcasts "You have killed 2 demons" and so on.
LUA:
function onKill(cid, target, lastHit)
local t = {
	["Demon"] = {s = 3000},
	["Juggernaut"] = {s = 3001},
	["Hellfire Fighter"] = {s = 3002},
	["Fire Overlord"] = {s = 3003},
	["Sea Serpent"] = {s = 3004},
	["Wyrm"] = {s = 3005},
	["Zombie"] = {s = 3006},
	["Banshee"] = {s = 3007},
	["Medusa"] = {s = 3008},
	["Blazing Fire Elemental"] = {s = 3009},
	["Giant Spider"] = {s = 3010},
	["Frost Dragon"] = {s = 3011},
	["Massive Energy Elemental"] = {s = 3012},
	["Massive Water Elemental"] = {s = 3013}
}
local name = getCreatureName(target)
local v = t[name]
	if v then
		if getCreatureName(target) then
			setPlayerStorageValue(cid, v.s, getPlayerStorageValue(cid, v.s)+1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed a " .. getCreatureName(target) .. ".")
			if getPlayerStorageValue(cid, v.s) >= 100 then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
			end
		end
	end
	return true
end

I need to add something like
LUA:
	setPlayerStorageValue(cid, monsterstorage, getPlayerStorageValue(cid, monsterstorage) + 1)
				doPlayerSendTextMessage(cid, "".. getPlayerStorageValue(cid, monsterstorage) .." / ".. monstenName .." ".. monstername .."s killed.")
But i don't know how to register those monster storages and monster names in setPlayerStorageValue and getPlayerStorageValue functions.
 
Not tested, shoud be work ;p
LUA:
function onKill(cid, target, lastHit)
local t = {
	["Demon"] = {s = 3000},
	["Juggernaut"] = {s = 3001},
	["Hellfire Fighter"] = {s = 3002},
	["Fire Overlord"] = {s = 3003},
	["Sea Serpent"] = {s = 3004},
	["Wyrm"] = {s = 3005},
	["Zombie"] = {s = 3006},
	["Banshee"] = {s = 3007},
	["Medusa"] = {s = 3008},
	["Blazing Fire Elemental"] = {s = 3009},
	["Giant Spider"] = {s = 3010},
	["Frost Dragon"] = {s = 3011},
	["Massive Energy Elemental"] = {s = 3012},
	["Massive Water Elemental"] = {s = 3013}
}
local name = getCreatureName(target)
local v = t[name]
	if v then
		if getCreatureName(target) then
			setPlayerStorageValue(cid, v.s, getPlayerStorageValue(cid, v.s)+1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, v.s).." / 100 " .. getCreatureName(target) .. ".")
			if getPlayerStorageValue(cid, v.s) >= 100 then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
			end
		end
	end
	return true
end
 
Humm i killed the creature and it just stood there with no HP and it didn't die and kills started to count real fast :D
00:45 You have killed 0 / 100 Hellfire Fighter.
00:45 You have killed 1 / 100 Hellfire Fighter.
00:45 You have killed 2 / 100 Hellfire Fighter.
00:46 You have killed 3 / 100 Hellfire Fighter.
00:46 You have killed 4 / 100 Hellfire Fighter.
00:46 You have killed 5 / 100 Hellfire Fighter.


I think i have messed something else up, i ream really tired right now and i'm going to bed but tomorrow i will sort everything out and see if your script works! Thank you for trying! If it works i'll rep ya tomorrow.
 
Code:
function onKill(cid, target, lastHit)
local t = {
	["Demon"] = {s = 3000},
	["Juggernaut"] = {s = 3001},
	["Hellfire Fighter"] = {s = 3002},
	["Fire Overlord"] = {s = 3003},
	["Sea Serpent"] = {s = 3004},
	["Wyrm"] = {s = 3005},
	["Zombie"] = {s = 3006},
	["Banshee"] = {s = 3007},
	["Medusa"] = {s = 3008},
	["Blazing Fire Elemental"] = {s = 3009},
	["Giant Spider"] = {s = 3010},
	["Frost Dragon"] = {s = 3011},
	["Massive Energy Elemental"] = {s = 3012},
	["Massive Water Elemental"] = {s = 3013}
}
local name = getCreatureName(target)
local v = t[name]
	if v then
		if getCreatureName(target) then
			setPlayerStorageValue(cid, v.s, getPlayerStorageValue(cid, v.s)+1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, v.s).." / 100 " .. getCreatureName(target) .. ".")
			if getPlayerStorageValue(cid, v.s) >= 100 then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
			end
		end
	end
	return true
end

change for

Code:
function onKill(cid, target, lastHit)
local t = {
	["Demon"] = {s = 3000},
	["Juggernaut"] = {s = 3001},
	["Hellfire Fighter"] = {s = 3002},
	["Fire Overlord"] = {s = 3003},
	["Sea Serpent"] = {s = 3004},
	["Wyrm"] = {s = 3005},
	["Zombie"] = {s = 3006},
	["Banshee"] = {s = 3007},
	["Medusa"] = {s = 3008},
	["Blazing Fire Elemental"] = {s = 3009},
	["Giant Spider"] = {s = 3010},
	["Frost Dragon"] = {s = 3011},
	["Massive Energy Elemental"] = {s = 3012},
	["Massive Water Elemental"] = {s = 3013}
}
local name = getCreatureName(target)
local v = t[name]
	if v then
		if getCreatureName(target) then
			setPlayerStorageValue(cid, v.s, getPlayerStorageValue(cid, v.s)+1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, v.s).." / 100 " .. getCreatureName(target) .. ".")
			elseif getPlayerStorageValue(cid, v.s) >= 100 then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have killed the required number.")
			end
		end
	end
	return true
end

check, if you have problem, post in here.
 
Back
Top