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

IDs Problem

new amiroslo

New Member
Joined
Jun 3, 2011
Messages
29
Reaction score
0
Well Razor Blade Was trying to help me! And i coudnt get the error from the console but when i use /i it aint working anymore.
I want it like Under Access 5 cant use /i on some items only access 5 and higher!
If anyone can help then thanks :D

Rep++

Code:
local godIDs = {5785, 8189, 2646, 9777, 2523, 8931, 2316, 2312, 7289, 9776, 2433, 2352, 8858, 9969}

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local t = string.explode(param, ",")
	local ret = RETURNVALUE_NOERROR
	local pos = getCreaturePosition(cid)

	
	if getPlayerGroupId(cid) == 5 then
		local canMakeDonations = true
	else
		local canMakeDonations = false
	end
	local id = tonumber(t[1])
	
	if (isInArray(id, godIDs)) or (isInArray(getItemIdByName(t[1])), godIDs) then
		if canMakeDonations then
			if(not id) then
				id = getItemIdByName(t[1], false)
				if(not id) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exist.")
					return true
				end
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only Gods can create donation items.")
		end
	else
		if(not id) then
			id = getItemIdByName(t[1], false)
			if(not id) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exist.")
				return true
			end
		end
	end


	local amount = 100
	if(t[2]) then
		amount = t[2]
	end

	local item = doCreateItemEx(id, amount)
	if(t[3] and getBooleanFromString(t[3])) then
		if(t[4] and getBooleanFromString(t[4])) then
			pos = getCreatureLookPosition(cid)
		end

		ret = doTileAddItemEx(pos, item)
	else
		ret = doPlayerAddItemEx(cid, item, true)
	end

	if(ret ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
		return true
	end

	doDecayItem(item)
	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end

	return true
end
 
Back
Top