Permissions

Permissions

Postby Warren1001 » 04 Jun 2013, 03:29

Code: Select all
                if (who.group.Permission >= p.group.Permission)
                {
                    Player.SendMessage(p, Server.DefaultColor + "You cannot warn someone of the same or higher rank than you.");
                    return;
                }

How to make it to where who.group.permission is operator +, so the player, reguardless of rank, can ignore anybody lower than operator?
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: Permissions

Postby Conor » 04 Jun 2013, 04:35

Warren1001 wrote:
Code: Select all
                if (who.group.Permission >= p.group.Permission)
                {
                    Player.SendMessage(p, Server.DefaultColor + "You cannot warn someone of the same or higher rank than you.");
                    return;
                }

How to make it to where who.group.permission is operator +, so the player, reguardless of rank, can ignore anybody lower than operator?


I'm not entirely sure what you're asking for but I can try to help with some examples.

Code: Select all
if (p.group.Permission >= LevelPermission.Operator)
{
   // Player p is op+
}


Code: Select all
if (p.group.Permission >= who.group.Permission && who.group.Permission < LevelPermission.Operator)
{
   // Player p is a greater rank than Player who
   // Player who is not an op+
}


This one might be what you are looking for?
Code: Select all
if (who.group.Permission >= p.group.Permission && who.group.Permission >= LevelPermission.Operator)
{
   Player who is a greater rank than Player p
   Player who is an op+
}


There are tonnes of ways of writing the same thing with if statements, especially with operators within them too. If none of the above help you then explain your dilemma clearer and I will try and give you more advice.
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: Permissions

Postby Warren1001 » 04 Jun 2013, 04:44

For an example, take the command /ignore
now put it on a lava server with lots of ranks that are below op (just show off ranks)
Using the thing I put, guests can't ignore the rank above them, but they aren't operator.
I'd like guests to ignore the highest rank possible (below operator), and vice versa.
Meaning guests can ignore everybody but operators +
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: Permissions

Postby ismellike » 04 Jun 2013, 05:44

I just updated the ignore command with that example, nice idea/suggestion btw

I used

Code: Select all
if(who.group.Permission>=LevelPermssion.Operator){
//do stuff
}


It checks if the player specified is at or above op permission and if they are, the code only sends the player a message
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 6 guests

cron