PDA

View Full Version : [508] Rights, Some Snippets.



Faab234
June 26th, 2010, 17:16
This are some Snippets to handle rights in 508 Frameworks like Palidino76, Bulby, Espeon, RS2Pro, CodeUSA.


1: getRights


/*
* Returns p.Rights
*/
public int getRights() {
return p.rights;
}

How to use:


if (getRights == 0) {

}

2: parseString or parseUserTitle


/*
* Int to String, Input 2:, Output: Administrator. Default: Member. Returns a Usertitle.
*/

public String parseString(int Rights) {
switch(Rights) {
case 0:
return "Member";
break;
case 1:
return "Moderator";
break;
case 2:
return "Administrator";
break;
default:
return "Member";
break;
}
}

How to use:


p.sendMessage("Faab is Promoted to "+parseString(2));


3: parseInt or parseRights


/*
* String to Int, Input Admin, Output 2. Default 0.
*/
public int parseInt(String Rights) {
if (Rights.equals("Member") {
return 0;
} else if (Rights.equals("Moderator") {
return 1;
} else if (Rights.equals("Administrator") {
return 2;
} else if (Rights.equals("Mod") {
return 1;
} else if (Rights.equals("Admin") {
return 2;
} else {
return 0;
}

How to use:


p.rights = parseInt("Administrator");

All: Sure, you can rename it.

4: End
I will release a RightManager.

Fire cape
June 26th, 2010, 17:44
Good job.

pivotgamer84
June 27th, 2010, 03:07
Interesting, but it seems really easy to add if you know how to add methods for yourself.
Good for noobs, so I won't rate because I know this stuff.

Faab234
June 27th, 2010, 09:54
Interesting, but it seems really easy to add if you know how to add methods for yourself.
Good for noobs, so I won't rate because I know this stuff.

Yes, Simple Snippets.

firescape_team
June 27th, 2010, 23:26
Good job faab