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

"Only Gamemasters can pull this lever"

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
yo xd can someone make a script for me, that only a GM or above can pull it?:O

i think it's easy, but i don't want to risk my server getting crashed or sth :p
 
Lua:
function onUse(cid, item)
--Config Start--
	--IDs of the lever
		LeverIDS = {left=1945, right=1946}
	--Minimum access to pull the lever
		MinimumAccess = 4
	--If the player isn't gamemaster, what's the message?
		CancelMSG = "You need to be a gamemaster to pull this lever."
--Config End--
	if getPlayerAcess(cid) >= MinimumAccess then
		doTransformItem(item.uid, LeverIDS.left or LeverIDS.right)
	else
		doPlayerSendCancel(cid, CancelMSG)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
return true
end
 
Lua:
local config = {
	MinGroupId = 4,
	CancelMsg = "You need to be a gamemaster to pull this lever."
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerGroupId(cid) >= config.MinGroupId then
		if item.itemid == 1945 then
			doTransformItem(item.uid, 1496)
		elseif item.itemid == 1496 then
			doTransformItem(item.uid, 1495)
		end
	else
		doPlayerSendCancel(cid, config.CancelMSG)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
	return TRUE
end
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    local pos1 = {x=998, y=1021, z=7, stackpos=1}
    local pos2 = {x=998, y=1032, z=7, stackpos=1}
 
    if getPlayerLevel(cid) >= 100 then
        if item.itemid == 9825 then 
 
            wall1 = getThingfromPos(pos1).uid
			wall2 = getThingfromPos(pos2).uid
 
            doRemoveItem(wall1)
			doRemoveItem(wall2)
 
            doTransformItem(item.uid, item.itemid + 1)
			doBroadcastMessage("Chess!")
 
        elseif item.itemid == 9826 then
 
            doCreateItem(1536, pos1)
			doCreateItem(1536, pos2)
 
            doTransformItem(item.uid, item.itemid - 1)
        end
    else
        doPlayerSendTextMessage(cid,22,'You need to be at least level 100 to pull this lever.')
end
   return 1
end

Can any1 of u make only gms (access 4) can pull it?;o
 
Lua:
local pos1 = {x=998, y=1021, z=7, stackpos=1}
local pos2 = {x=998, y=1032, z=7, stackpos=1}
	
function onUse(cid, item, fromPosition, itemEx, toPosition)

local wall1 = getThingfromPos(pos1)
local wall2 = getThingfromPos(pos2)
			
	if getPlayerGroupId(cid) == 4 then
		if getPlayerLevel(cid) >= 100 then
			if item.itemid == 9825 then 
				doRemoveItem(wall1.uid)
				doRemoveItem(wall2.uid)
				doTransformItem(item.uid, item.itemid + 1)
				doBroadcastMessage("Chess!")
			elseif item.itemid == 9826 then
				doCreateItem(1536, pos1)
				doCreateItem(1536, pos2)
				doTransformItem(item.uid, item.itemid - 1)
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need to be at least level 100 to pull this lever.')
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Only gamemasters can pull this lever.')
	end
	return TRUE
end
 
Back
Top