Jump to content

Private message by shrubbot level


BECK

Recommended Posts

  • Subscriber

I looked in the docs, maybe something like this already exists but I couldn't find it. 

 

There are times when sending a PM to a group of people is very useful.  On our server, if I want to communicate with my members, I just do "/m iow blah blah blah".  That usually works -- UNLESS your members are in alias.

 

It would be nice to be able to do something like: "/ml 4 message to all level 4 and above".

 

So its the ml command.  It takes a shrubbot level as the first argument and sends the private message to all players who match that level AND above.   That way, I can communicate with my members without worrying to exclude people based on their name at the time.   I suppose it is somewhat similar to the /ma command, but we have that exclusively for our admins.     But this would be a way for even lower level members to be able to communicate only with their fellow clanmates.

 

Like I said, if something like this already exists, I apologize for posting here, but I couldn't find it. 

 

Thanks! Hope you find this a good suggestion and something easy to implement.

Link to comment
Share on other sites

  • Management

I think this would be easiest to implement with a Lua script. You could make a custom command to shrubbot.cfg such as "ml". This command would then get directed to Lua script, which would send private message to all connected players with level higher then what you have specified. Excluding the player who issued the command. Or you could exclude the level from the command and have something like "mm", which would send it to all connected players having some specified member level and above. Specified in the script.

 

Related links

http://mygamingtalk.com/wiki/index.php/Silent_Lua#G_shrubbot_level

 

About implementing this in the shrubbot, it is rather server specific and I would rather see something more generic.

Link to comment
Share on other sites

  • 1 month later...
  • Subscriber

This is possible. It has already been done if i'm correct, Micha has a script around for it, I may also still have it. let me know if you still need it i can for sure get it for you :D

 

Yes, way too busy atm to try and write one myself.   Much appreciated!

Link to comment
Share on other sites

Yes, way too busy atm to try and write one myself.   Much appreciated!

--[[
Purple Admin Chat
Version 0.1

--]]

modname = "AdminChat"
version = "0.1"
admin_chat = "ml"
min_level = 3


function et_InitGame(levelTime, randomSeed, restart)
  et.RegisterModname(modname .. " " .. version)
  maxclients = tonumber(et.trap_Cvar_Get("sv_maxclients"))-1
end

function et_ClientCommand(clientNum, command) 
   if command == admin_chat and getlevel(clientNum) then
		if et.trap_Argc() > 1 then
		local message = ""
			for i = 1, et.trap_Argc() - 1, 1 do
				message = message .. et.trap_Argv(i) .. " "
			end
			for i = 0, maxclients, 1 do
				sendstring = playerName(clientNum) .. " ^w(^8AdminChat^w)^8: " .. message
				et.trap_SendServerCommand(i, "chat \"" .. sendstring .. "\"")
				return 1
			end
		end
		elseif command == admin_chat and not getlevel(clientNum) then
			et.trap_SendServerCommand(clientNum, "cpm \"^1 You Are Not Allowed To Use Admin Chat.\n\" " )
		return 1
    end
end

function getlevel(client)
	local lvl = et.G_shrubbot_level(client)
	if lvl >= min_level then
		return true
	end
		return nil
end

function playerName(id)
  local name = et.Info_ValueForKey(et.trap_GetUserinfo(id), "name")
  if name == "" then
    return "*unknown*"
  end
  return name
end
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...