Aw check right

From ActiveWiki
Revision as of 10:38, 2 November 2008 by Macavity (talk | contribs) (Added in, cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



Minimum requirements
Added in version 4.1


int aw_check_right (int citizen, char *str)

Description

Checks if a particular citizen would be granted rights by the provided string.

Callback

None (returns immediately)

Notes

This method requires that a bot instance has been created. It does not matter to which universe or world it is connected.

Arguments

citizen
Citizen number to check.
str
String containing a rights list.

The string must be formatted according the rules for rights lists:

0    ... tourists
any# ... citizen number
-    ... exclusion sign
#~#  ... citizen range
*    ... everyone
, blank  ... delimiters

For example, "1~2300,-512~1024" would grant rights to citizen number in the range between 1 to 2300, but will deny rights to citizen numbers in the range between 512 to 1024.

Argument attributes

None

Return values

1
If the citizen number would be granted rights by the rights string.
0
Not granted rights. It is also returned if no instance has been created.

Returned attributes

None

Usage

Check for rights.

#define RIGHTS "1~2300,-512~1024"

aw_create ("", 0, NULL);

if (aw_check_right (176, RIGHTS))
  printf ("Citizen# 176 has rights assigned\n");
else
  printf ("Citizen# 176 has no rights assigned\n");

See also