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

Solved Kill Player Command 0.3.6 Sloved

Boza

New Member
Joined
Feb 16, 2010
Messages
184
Reaction score
0
Sloved!

Kill Player command for TFS 0.3.6
Credits go to Cykotitan.

Lua:
function onSay(cid, words, param, channel)
	if param == '' then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	end
	local pid = getPlayerByNameWildcard(param)
	if not isPlayer(pid) or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid)) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You killed " .. param .. "!")
	doPlayerSendTextMessage(pid, MESSAGE_EVENT_ORANGE, "You were killed by an admin!")
	return doCreatureAddHealth(pid, - getCreatureMaxHealth(pid))
end

Don't Forget to add this in data/talkactions/scripts

Code:
<talkaction log="yes" access="5" words="/kill" event="script" value="killplayer.lua"/>
 
Last edited:
Code:
function onSay(cid, words, param, channel)
	if param == '' then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	end
	local pid = getPlayerByNameWildcard(param)
	if not isPlayer(pid) or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid)) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You killed " .. param .. "!")
	doPlayerSendTextMessage(pid, MESSAGE_EVENT_ORANGE, "You got killed by an admin!")
	return doCreatureAddHealth(pid, - getCreatureMaxHealth(pid))
end
And now post your reward.lua
 
Last edited:
Lua:
function onDeath(cid, corpse, deathList)
	if isPlayer(cid) then
		local v = { killer_name = getCreatureName(deathList[1]), killer_level = getPlayerLevel(deathList[1]), target_name = getCreatureName(cid), target_level = getPlayerLevel(cid) }
		local reward = doAddContainerItem(corpse.uid, 5943, 1)
		doItemSetAttribute(reward, "description", "" .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. v.target_level .. " by " .. v.killer_name .. " who was level " .. v.killer_level .. " at the time. " .. "This death was " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "[Unjustified]" or "[Justified]"))
		doItemSetAttribute(reward, "name", v.target_name .."'s Heart")
	end
	return true
end

@top
 
Code:
function onSay(cid, words, param, channel)
	if param == '' then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	end
	local pid = getPlayerByNameWildcard(param)
	if not isPlayer(pid) or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid)) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
	end
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You killed " .. param .. "!")
	doPlayerSendTextMessage(player, MESSAGE_EVENT_ORANGE, "You got killed by an admin!")
	return doCreatureAddHealth(player, - getCreatureMaxHealth(player))
end
And now post your reward.lua

Code:
[Error - TalkAction Interface] 
 data/talkactions/scripts/killplayer.lua:onSay
 Description: 
 (luaDoPlayerSendTextMessage) Player not found

 [Error - TalkAction Interface] 
 data/talkactions/scripts/killplayer.lua:onSay
 Description: 
 (luaGetCreatureMaxHealth) Creature not found

 [Error - TalkAction Interface] 
 data/talkactions/scripts/killplayer.lua:onSay
 Description: 
 data/talkactions/scripts/killplayer.lua:11: attempt to perform arithmetic on a boolean value
 stack traceback:
 data/talkactions/scripts/killplayer.lua:11: in function <data/talkactions/scripts/killplayer.lua:1>
 
Last edited:
Edited the first post

And the creaturescript:
Code:
function onDeath(cid, corpse, deathList)
	if isPlayer([B][COLOR="Red"]deathList[1][/COLOR][/B]) then
		local v = { killer_name = getCreatureName(deathList[1]), killer_level = getPlayerLevel(deathList[1]), target_name = getCreatureName(cid), target_level = getPlayerLevel(cid) }
		local reward = doAddContainerItem(corpse.uid, 5943, 1)
		doItemSetAttribute(reward, "description", "" .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. v.target_level .. " by " .. v.killer_name .. " who was level " .. v.killer_level .. " at the time. " .. "This death was " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "[Unjustified]" or "[Justified]"))
		doItemSetAttribute(reward, "name", v.target_name .."'s Heart")
	end
	return true
end
 
Back
Top