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

Remove vip items from /i command

Nightimarez

New Member
Joined
Jul 24, 2008
Messages
287
Reaction score
2
I don't want gamemasters to create vip items with /i. Here is the script i use to create items.

PHP:
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)

	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 wich such name does not exists.")
			return true
		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

I'm not sure, but it could probably look something like this.

PHP:
	if(t[1] <= 1 or t[1] == 2493 or (t[1] > 2494 and t[1] < 2495) or t[1] > 2195) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must donate.")
		return true
	end
 
Last edited:
Code:
local notAllowed = {2493, 2494, 2495}

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) 

    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 wich such name does not exists.") 
            return true 
        end 
    end 

    local amount = 100 
    if(t[2]) then 
        amount = t[2] 
    end 
	
	if isInArray(notAllowed, id) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't make this item.")
		return true
	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
Insert ids into notAllowed table.
 
Back
Top