• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction [Command] /kill ...

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
120
Location
Germany
GitHub
Shawak
Here a script, that kills player :D.
It's for TFS 0.3.4.

data/talkaction/scripts/kill.lua
Lua:
local config = {
--[[
	Fun Script Kill v1.0
	by Maxi (Shawak)
]]--	
	-- CONFIG --------------------------------------------------

	timeToDie = 5     -- after this seconds, the player die

	-- CONFIG END ----------------------------------------------

}	-- Don't touch ----------------
	local z = config.timeToDie
	local events = {} 
	local fight = createConditionObject(CONDITION_INFIGHT, (config.timeToDie*1000+100))
	-------------------------------

function onSay(cid, words, param, channel)
	local player = getPlayerByNameWildcard(param)
	local message = ""..getCreatureName(cid).." decided to kill you in ..."

	if (player ~= nil) and (isPlayer(cid) == TRUE) then
		if getPlayerGroupId(player) == 1 then
			doAddCondition(player, fight)
			events = addEvent(text,100,{cid = cid, player = player})
			doPlayerSendTextMessage(player,18,message)
		else
			doPlayerSendTextMessage(cid,18,"You can only kill players.")
		end
	else
		doPlayerSendTextMessage(cid,18,"Player not found.")
	end
	return TRUE
end

function text(parameters)
	local cid = parameters.cid
	local player = parameters.player

	if (getPlayerLevel(player) ~= FALSE) then
		if z >= 1 then
			doPlayerSendTextMessage(player,18,""..z.."")
			events = addEvent(text,1000,{cid = cid, player = player})
			z = z-1
		elseif z == 0 then
			z = config.timeToDie
			events = nil
			doCreatureAddHealth(player,-getCreatureHealth(player))
			doPlayerSendTextMessage(cid,18,"You killed "..getCreatureName(player)..".")
		end
	end
	return TRUE
end

data/talkactions/talkactions.xml
HTML:
<talkaction words="/kill" event="script" value="kill.lua"/>

Command:
!kill ...
(... = playername)


Screenshot:
2qi1ked.jpg

17:08 You are dead.

After saying !kill ..., the player have 5 sec,.. you can change that here:
Lua:
timeToDie = 5
Just change 5 to 6, 7, or something else.

I hope you like it :thumbup:.
And if you liked it, please don't forget to Rep++ me :D.

Regards,
Shawak
 
Last edited:
You could also do it to kill the creature/player you are targetting if the param is empty. :)
 
ohoh, use doMoveCreature, it'll look more funny when player will be pushed arround :D
 
Nice script, maybe i won't use it but only becouse it's not my ots style. :p But keep going. :)
 
Bug!

[02/09/2009 11:18:04] Lua Script Error: [TalkAction Interface]
[02/09/2009 11:18:04] data/talkactions/scripts/kill.lua:eek:nSay

[02/09/2009 11:18:04] luaAddEvent(). Callback parameter should be a function.

i use tfs 0.3.5^^
 
Back
Top