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

[TFS 0.4] A Simple Command

Dejm

Oh hun...
Joined
Nov 29, 2008
Messages
120
Reaction score
4
Location
United Kingdom
Hey ya,

Is there a person that can make a Command which add items to everyone who is online?
For example:

Code:
[COLOR="lime"]/additem[/COLOR] [COLOR="purple"][COLOR="red"]2160[/COLOR][/COLOR],[COLOR="blue"]5[/COLOR] - add item to everyone who is online.
________________________________________________________________
[COLOR="lime"]*Command[/COLOR]
[COLOR="red"]*Item number[/COLOR]
[COLOR="blue"]*Amount[/COLOR]
 
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	end

	local t = string.explode(param, ",")

	local id = tonumber(t[1])
	if not id then
		id = getItemIdByName(t[1], false)
		if not id then
			return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exist.")
		end
	end

	t[2] = tonumber(t[2])
	local amount = t[2] or 1

	for _, pid in ipairs(getPlayersOnline()) do
		doDecayItem(doPlayerAddItem(pid, id, amount))
	end

	return true
end
 
Back
Top