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

/i edited by: cyko - that only alow X names to make Ys items - bug

Luciano

Member
Joined
Feb 18, 2010
Messages
998
Reaction score
24
It was working fine.
Only Names "Inferno-OT Owner" and "Dagon Nightshade" were able to make items with ids x y z.
Now i had to put a new name there, and i get error.
Script:
Code:
prelocal _t = {
	restricted = {2196, 7461, 2505, 3975, 2507, 3982, 5958, 7423, 7416, 7435, 7427, 7958, 7426, 9975, 5785, 8932, 9927, 8879, 9928, 7892, 2537, 2300, 2316, 2297, 2128, 8880, 9777, 7893, 6391, 2275, 2312, 2363, 8306, 2424, 7420, 2408, 7437, 8854, 2299, 9003, 5887, 7423, 8752, 7404, 2307, 2284, 2267, 2290, 2272, 2263, 7425, 8926, 8980, 2350, 8927, 6531, 7959, 5927, 2538, 7443, 7439, 9930, 2127, 2123, 7735, 2264, 9971, 7902, 8887, 7730, 11233, 8907, 11295, 11294, 11297, 11296, 7460, 7708, 8299, 2309, 7618, 8305, 8301, 7429, 7451,  5907, 7900, 7431, 8931, 7412},
	allowedNames = {'Inferno-ot Owner','Dagon Nightshade','Admin Luciano'}

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 tmp = getCreaturePosition(cid)

	local id = tonumber(t[1])
	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

	if isInArray(_t.restricted, id) and not isInArray(_t.allowedNames, getCreatureName(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot create donated items.")
		return true
	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
			tmp = getPlayerLookPos(cid)
		end

		ret = doTileAddItemEx(tmp, 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

	doSendMagicEffect(tmp, CONST_ME_MAGIC_RED)
	return true
end

error:
Code:
[Error - LuaScriptInterface::loadFile] data/talkactions/scripts/createitem.lua:1: '=' expected near '_t'
[Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/createitem.lua
[Warning - TalkAction::loadScript] Event onSay not found (data/talkactions/scripts/createitem.lua

Ty,
Luciano


Rep++++ oFC
 
OBS: i write those errors - copyed - but typed manually - if i do ctrl + c something strange hapen on putyy .-. and oh shit donator out
 
Code:
local _t = {
	restricted = {2196, 7461, 2505, 3975, 2507, 3982, 5958, 7423, 7416, 7435, 7427, 7958, 7426, 9975, 5785, 8932, 9927, 8879, 9928, 7892, 2537, 2300, 2316, 2297, 2128, 8880, 9777, 7893, 6391, 2275, 2312, 2363, 8306, 2424, 7420, 2408, 7437, 8854, 2299, 9003, 5887, 7423, 8752, 7404, 2307, 2284, 2267, 2290, 2272, 2263, 7425, 8926, 8980, 2350, 8927, 6531, 7959, 5927, 2538, 7443, 7439, 9930, 2127, 2123, 7735, 2264, 9971, 7902, 8887, 7730, 11233, 8907, 11295, 11294, 11297, 11296, 7460, 7708, 8299, 2309, 7618, 8305, 8301, 7429, 7451,  5907, 7900, 7431, 8931, 7412},
	allowedNames = {'Inferno-ot Owner','Dagon Nightshade','Admin Luciano'}
[COLOR="Red"][B]}[/B][/COLOR]
 
Last edited:
Thaaaaaaaaaaaaaaaankssss
rep++++ worked fine thank you ;d
damn im not donater anymore - cant change thread name and close x.x
 
Back
Top