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

/c Command

Seanr

New Member
Joined
Jul 11, 2011
Messages
167
Reaction score
3
Location
Mo Town
Is there anyway I can make CMs (access 5) or GMs (access 4) not able to use /c on my admin? (access 6) It's rather annoying..
 
Add
Lua:
	if(getPlayerAccess(target) == 6 and getPlayerAccess(target) > getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
		return true
	end
To your teleporthere.lua
 
Add
Lua:
	if(getPlayerAccess(target) == 6 and getPlayerAccess(target) > getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
		return true
	end
To your teleporthere.lua


function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return TRUE
end
local target = getPlayerByNameWildcard(param)
if(not target) then
target = getCreatureByName(param)
if(not target) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
return TRUE
end
end
if(isPlayerGhost(target) and getPlayerGhostAccess(target) > getPlayerGhostAccess(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
return TRUE
end
local pos = getClosestFreeTile(target, getCreaturePosition(cid), false, false)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
return TRUE
end
local tmp = getCreaturePosition(target)
if(doTeleportThing(target, pos, TRUE) and not isPlayerGhost(target)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return TRUE
end




Can you show me where to put that? lmao
 
Add
Lua:
	if(getPlayerAccess(target) == 6 and getPlayerAccess(target) > getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
		return true
	end
To your teleporthere.lua

You don't need to confirm player access, that is being done in talkactions.xml

Lua:
if(getPlayerAccess(target) > getPlayerAccess(cid)) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
	return true
end
This will ensure that you can not do /c to anyone who got higher access than yourself. Should be enough?
 
You don't need to confirm player access, that is being done in talkactions.xml

Lua:
if(getPlayerAccess(target) > getPlayerAccess(cid)) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
	return true
end
This will ensure that you can not do /c to anyone who got higher access than yourself. Should be enough?




I hope this is true, but..where do I add!? lol
 
Here is the integrated version of what you posted:
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end
	local target = getPlayerByNameWildcard(param)
	if(not target) then
		target = getCreatureByName(param)
		if(not target) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
			return TRUE
		end
	end
	if(isPlayerGhost(target) and getPlayerGhostAccess(target) > getPlayerGhostAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
		return TRUE
	end
	local pos = getClosestFreeTile(target, getCreaturePosition(cid), false, false)
	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return TRUE
	end
	if(getPlayerAccess(target) > getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
		return true
	end
	local tmp = getCreaturePosition(target)
	if(doTeleportThing(target, pos, TRUE) and not isPlayerGhost(target)) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end
	return TRUE
end
 
You don't need to confirm player access, that is being done in talkactions.xml

Lua:
if(getPlayerAccess(target) > getPlayerAccess(cid)) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to do this.")
	return true
end
This will ensure that you can not do /c to anyone who got higher access than yourself. Should be enough?

I thought about it, but wrote strictly what he asked for. What if a GM who has access 4 wants to /c one who has access 5? He should be able to. It depends on what he wants..

Also, it's not getPlayerAccess(cid), it's getPlayerAccess(target).
 
Back
Top