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

Requesting a !gms script

JoSePh15_

Well-Known Member
Joined
Jan 28, 2010
Messages
1,766
Reaction score
59
I want the script when i say !gms it lists me all the gms in the server and write beside it the access
for example:

Admin Youssef [ADMIN]
Blabla [Community Manager]

Please help me out i give rep++
 
PHP:
function onSay(cid, words, param)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Support:")
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Admin Youssef ['.. getPlayerAccess.. ']")
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Blabla ['.. getPlayerAccess.. ']")
return TRUE
end
 
Code:
function onSay (cid, words, param, channel)
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"Support:")
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Admin Youssef ["..getPlayerAccess(cid).."]\nCM Blabla ["..getPlayerAccess(cid).."]")
    return true
  end

This will probably work but I think it's a bad way to do it..
 
I want it to get it from my mysql database and put it in a table... Sorry if i wasn't clear enough.. Table = popfyg thanks I give rep++
 
just copied and changed some stuff in online.lua that comes with tfs, dunno if it works though xd
Code:
function onSay(cid, words, param, channel)
	local players = getPlayersOnline()
	local strings = {""}

	local i, position = 1, 1
	local added = false
	for _, gms in ipairs(players) do
		if(added) then
			if getPlayerAccess(gms) >= 2 then
				if(i > (position * 7)) then
					strings[position] = strings[position] .. ","
					position = position + 1
					strings[position] = ""
				else
					strings[position] = i == 1 and "" or strings[position] .. ", "
				end
			end
		end
		if getPlayerAccess(gms) >= 2 then
			strings[position] = strings[position] .. getCreatureName(gms) .. " [" .. getPlayerGroupName(gms) .. "]"
			i = i + 1
			added = true
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " Gamemaster(s) online:")
	for i, str in ipairs(strings) do
		if(str:sub(str:len()) ~= ",") then
			str = str .. "."
		end

		doPlayerSendTextMessage(cid, MESSAGE_LAST, str)
	end

	return true
end
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="player_access"  enabled="yes">
	<config name="c"><![CDATA[
		config = {
			maxPlayers = 10
		}
	]]></config>
	<talkaction words="!access" event="script"><![CDATA[
		domodlib("c")
		local result = db.getResult("SELECT * FROM `players` WHERE `group_id` > 1;")
		local final, i = "", 0
		local ter = ""
		while true do
			final = final .. "[" .. result:getDataString("name") .. "] - Group Id: " .. result:getDataInt("group_id")
			local n = result:getDataInt("group_id")
			if n == 2 then
				ter = "Tutor"
			elseif n == 3 then
				ter = "Senior tutor"
			elseif n == 4 then
				ter = "Gamemaster"
			elseif n == 5 then
				ter = "Community Manager"
			elseif n == 6 then
				ter = "God"
			end
			final = final .. ", Group Name: " .. ter .. "\n"
			i = i + 1
			if not result:next() or i > config.maxPlayers then
				break
			end
		end
		result:free()
		return doShowTextDialog(cid, 2160, final)
	]]></talkaction>
</mod>
 
Back
Top