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

Solved Kill Broadcasting Amount Error

hallabackkid101

New Member
Joined
Feb 7, 2009
Messages
100
Reaction score
0
Location
Georgia, Usa
SOLVEDWhats up everyone! Im having a error with my script for broadcasting a players number of frags at a certain point. For instance, when the player gets a certain amount of kills without dieing, it will broadcast it. The broadcasting system works, but its off. I have to kill 7 people to get a broadcast saying I killed 5, same thing happens when I get to 10. It only broadcast it when I get to 12 frags. Any suggestions?

PHP:
-- ver. 1.1 2011-12-09
-- author tfs, otland.net/members/andypsylon
local c = {
	store = 6000, -- storage for Current frags like in login script
	tstore = 7000, -- Total Storage value for kills
	dstore = 8000, -- Total Storage value for deaths
	table = {
		{"Smashed!", 189, 1},
		{"Dead!", 190, 2},
		{"Owned!", 18, 3},
		{"Pwnt!", 215, 4}
	}
}
function onKill(cid, target)
	if(not isPlayer(target)) then return true end
 
	local getStor = getCreatureStorage(cid, c.store)
	local rand = math.random(1, #c.table)
	local name = getCreatureName(cid)
 
	doCreatureSetStorage(cid, c.store, (getStor + 1))
	doCreatureSetStorage(cid, c.tstore, (getCreatureStorage(cid, c.tstore) +1))
	doCreatureSetStorage(target, c.dstore, (getCreatureStorage(cid, c.dstore) + 1))
 
	doSendAnimatedText(getThingPosition(target), c.table[rand][1], c.table[rand][2])
 
	if(getStor == 5) then
		doBroadcastMessage(name .. " is on killing spree! He killed 5 players!")
	elseif(getStor == 10) then
		doBroadcastMessage(name .. " is dominating! He killed 10 players!")
	elseif(getStor == 25) then
		doBroadcastMessage(name .. " is CRAZY! He killed 25 players!")
	elseif(getStor == 50) then
		doBroadcastMessage(name .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
	elseif(getStor == 100) then
		doBroadcastMessage("Bow down to your new god "..name.." has 100 frags!")
	end
 
	return true
end
 
Last edited by a moderator:
Try this

LUA:
-- ver. 1.1 2011-12-09
-- author tfs, otland.netmembersandypsylon
local c = {
    store = 6000, -- storage for Current frags like in login script
    tstore = 7000, -- Total Storage value for kills
    dstore = 8000, -- Total Storage value for deaths
    table = {
        {Smashed!, 189, 1},
        {Dead!, 190, 2},
        {Owned!, 18, 3},
        {Pwnt!, 215, 4}
    }
}
function onKill(cid, target)
    if(not isPlayer(target)) then return true end

	local getStor = getCreatureStorage(cid, c.store)
    local rand = math.random(1, #c.table)
    local name = getCreatureName(cid)
 
    doCreatureSetStorage(cid, c.store, (math.max(0, getStor) + 1))
    doCreatureSetStorage(cid, c.tstore, (math.max(0, getCreatureStorage(cid, c.tstore)) + 1))
    doCreatureSetStorage(target, c.dstore, (math.max(0, getCreatureStorage(cid, c.dstore)) + 1))
 
    doSendAnimatedText(getThingPosition(target), c.table[rand][1], c.table[rand][2])

    local getStorAgain = getCreatureStorage(cid, c.store)
	if(getStorAgain == 5) then
        doBroadcastMessage(name .. " is on killing spree! He killed 5 players!")
    elseif(getStorAgain == 10) then
        doBroadcastMessage(name .. " is dominating! He killed 10 players!")
    elseif(getStorAgain == 25) then
        doBroadcastMessage(name .. " is CRAZY! He killed 25 players!")
    elseif(getStorAgain == 50) then
        doBroadcastMessage(name .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
    elseif(getStorAgain == 100) then
        doBroadcastMessage("Bow down to your new god " ..name.. " has 100 frags!")
    end
 
    return true
end
 
Back
Top