Jump to content

[HELP] I making a simple "/help" Script


rockstar35

Recommended Posts

Posted

Hello dear forum users,

im newbie on scripting .

now im doing a little help system.

Player say /help to chat .

like a "help me" text on chatbox

but other players can't see "help me" text

only admins can see it.

which funcitions useless for this

addCommandHandler

outputChatbox( how i can write text to only admins see)

 

Sorry for bad english my from Turkey :P

 

Posted

I have not tested this, but you should read about ACL Groups and ACL Lists

In your case i think you might be looking for something along these lines...

 

function helpMe()
	-- your code hre
end
addCommandHandler ( "help", helpMe)

 

And then in:

<acl name="Default">
        <right name="command.start" access="false" />
        <right name="command.stop" access="false" />
        <right name="command.stopall" access="false" />
        ...etc etc...
</acl>

Add:

<right name="command.help" access="false" />

 

Might not be spot on... but along those lines

 

  • Like 1
Posted (edited)

Jamie, i think he's talking about text that only admins can see, not commands that only admins can use...

So: outputChatBox's second parameter is what you are looking for. It's defaulted to root, so the text is visible to all children of root = all players.

I guess in you server there's no dummy element parent of admins (it would be not a normal thing...), so i think you should get all the admins and repeat the outputChatBox for every admin*

 

* To get the admins, you get all players. Then get their account and check if account is in "Admin" group with isObjectInACLGroup. If it is, output the text to that player:

--example
local players = getElementsByType( "player" ) --get ALL players
local adminACL = aclGetGroup ( "Admin" ) --get the admin acl group
for _,thePlayer in pairs(players) do --loop the players
	if isObjectInACLGroup( getPlayerAccount( thePlayer ), adminACL ) then --check if the account of that player is an admin
		outputChatBox( "Your text goes here", thePlayer ) --if it is, outputChatBox to him
	end
end

 

Edited by LoPollo
  • Like 1
Posted

Upon re-reading what he said, I agree that's what he probably wants, the user to be able to type /help "the message" and for it then to be delivered to admins only.

  • Like 1
Posted
2 hours ago, JamieSA said:

Upon re-reading what he said, I agree that's what he probably wants, the user to be able to type /help "the message" and for it then to be delivered to admins 

Yes its.

My english is not enough sorry for this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...