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

CreatureEvent M-M-M-Monster Kill !

Black Dove

Web-Developer
Joined
Apr 14, 2010
Messages
129
Reaction score
4
Location
Egypt
Extracted Of ( Warcraft Dota )

Open data/creaturescripts/creaturescripts.xml ... Add This

XML:
<event type="kill" name="pvpsystem" event="script" value="pvpsystem.lua"/>



Then data/creaturescripts/scripts .. login.lua

Lua:
registerCreatureEvent(cid, "pvpsystem")



Open data/creaturescripts/scripts ... And Creat pvpsystem.lua

Then Add

Lua:
local storage = {	 kills = 8003
}

local streaks = {
[2] = "DOUBLE KILL!",
[3] = "TRIPLE KILL!",
[5] = "M-M-M-MONSTER KILL!!",
[7] = "RAMPAGE!",
[9] = "UNSTOPPABLE!",
[12] = "HOLY SHIT!",
[15] = "GODLIKE!!"
}

function onKill(cid, target, lastHit)
if isPlayer(cid) and isPlayer(target) then
setPlayerStorageValue(cid, storage.kills, getPlayerStorageValue(cid, storage.kills) + 1)
setPlayerStorageValue(target, storage.kills, 0)
for _, pid in ipairs(getPlayersOnline()) do
local s = {"matou", "cortou em pedaços", "detonou", "humilhou", "Num Quero Falar Mais Nada Pra Foder"}
doPlayerSendChannelMessage(pid, "PVP", "".. getCreatureName(cid) .." ".. s[math.random(1, #s)] .." ".. getCreatureName(target) ..".", TALKTYPE_CHANNEL_Y, 10)
end
local k = streaks[getPlayerStorageValue(cid, storage.kills)]
if k then
doBroadcastMessage(getCreatureName(cid) .. " - ".. k, MESSAGE_INFO_DESCR)
end
end
return true
end



Done...
 
Last edited by a moderator:
(Not tested)

With this one, you'll have to kill players in 10 seconds or less to get the messages (Like LoL)
Lua:
local storage = 8003
local intervalStorage = 8004
local maxTime = 10 --max 10 seconds between kill before restart
 
local streaks = {
	[2] = "DOUBLE KILL!",
	[3] = "TRIPLE KILL!",
	[5] = "M-M-M-MONSTER KILL!!",
	[7] = "RAMPAGE!",
	[9] = "UNSTOPPABLE!",
	[12] = "HOLY SHIT!",
	[15] = "GODLIKE!!"
}

function onKill(cid, target, lastHit)
	if isPlayer(cid) and isPlayer(target) then
		if os.time() >= getCreatureStorage(cid, intervalStorage) then
			doCreatureSetStorage(cid, storage, 0)
		end
		doCreatureSetStorage(cid, storage, getCreatureStorage(cid, storage) + 1)
		doCreatureSetStorage(target, storage, 0)
		doCreatureSetStorage(cid, intervalStorage, os.time() + maxTime)
		--setPlayerStorageValue(cid, storage.kills, getPlayerStorageValue(cid, storage.kills) + 1)
		--setPlayerStorageValue(target, storage.kills, 0)
		for _, pid in ipairs(getPlayersOnline()) do
			local s = {"matou", "cortou em pedaços", "detonou", "humilhou", "Num Quero Falar Mais Nada Pra Foder"}
			doPlayerSendChannelMessage(pid, "PVP", "".. getCreatureName(cid) .." ".. s[math.random(1, #s)] .." ".. getCreatureName(target) ..".", TALKTYPE_CHANNEL_Y, 10)
		end
		local k = streaks[getPlayerStorageValue(cid, storage)]
		if k then
			doBroadcastMessage(getCreatureName(cid) .. " - ".. k, MESSAGE_INFO_DESCR)
		end
	end
	return true
end
 
And this is elegant version:
Lua:
local config = {
    storage = 8003,
    channel = 10,
    streaks = {
        [2] = "DOUBLE KILL!",
        [3] = "TRIPLE KILL!",
        [5] = "M-M-M-MONSTER KILL!!",
        [7] = "RAMPAGE!",
        [9] = "UNSTOPPABLE!",
        [12] = "HOLY SHIT!",
        [15] = "GODLIKE!!"
    },
    actions = { "killed", "cut into pieces", "detonated", "humbled" }
}



function onKill(cid, target, damage, flags, war)
    if not isPlayer(cid) or not isPlayer(target) then
        return true
    end

    local amount = math.max(0, getCreatureStorage(cid, config.storage)) + 1
    doCreatureSetStorage(cid, config.storage, amount)
    doCreatureSetStorage(target, config.storage, 0)

    local creatureName, targetName = getCreatureName(cid), getCreatureName(target)
    for _, player in ipairs(getPlayersOnline()) do
        doPlayerSendChannelMessage(player, "PVP", creatureName .. " " .. choose(config.actions) .. " " ..
            targetName, TALKTYPE_CHANNEL_Y, config.channel)
    end

    local streak = config.streaks[amount]
    if streak then
        doBroadcastMessage(creatureName .. " - ".. streak, MESSAGE_INFO_DESCR)
    end

    return true
end


_
Regards,
sn3ejk
 
Back
Top