integer llGetPermissions(); 

Returns which permissions have been granted. The return value will be a bitmask of the following values:

Constant: Result Allows
PERMISSION_DEBIT Permission to take money from agent’s account. Use of llGiveMoney.
PERMISSION_TAKE_CONTROLS Permission to take agent’s controls. Use of llTakeControls and llReleaseControls
PERMISSION_TRIGGER_ANIMATION Permission to trigger animation on agent. Use of llStartAnimation and llStopAnimation.
PERMISSION_ATTACH Permission to attach/detach from agent. Use of llAttachToAvatar and llDetachFromAvatar
PERMISSION_CHANGE_LINKS Permission to change links. Use of llCreateLink, llBreakLink, and llBreakAllLinks
PERMISSION_TRACK_CAMERA Permission to track the agent’s camera position and rotation Use of llGetCameraPos and llGetCameraRot
PERMISSION_CONTROL_CAMERA Permission to control the agent’s camera Use of llSetCameraParams and llClearCameraParams

To compare the resulting number to these constants, remember that it is necessary to use bitwise operators! That means doing if (llGetPermissions() & PERMISSION_ATTACH), not if (llGetPermissions() == PERMISSION_ATTACH). The latter may work some of the time, but not in all cases.


integer perm = llGetPermissions();

if (perm & PERMISSION_DEBIT) // using & is important! perm is a bitmask!
    // debit code goes here


Q: How does this know what agent to get the permissions from?
A: The last person who requested permissions. Use llGetPermissionsKey to find out the key of the agent.
Q: Is there a way to find out what permissions are already granted for a different agent, or do I need to keep a list of my own?
A: If you wanted a script to get permissions from more than one person, you would have to keep a list of your own.
Q: It’s returning a value that I check against the constants listed in the table above, and nothing happens. What’s up with that?
A: Are you sure you’re using bitwise operators in your IF statement? (For instance, & instead of ==?) The value returned by llGetPermissions is a bitfield, and will not equal any of the above constants if more than one have been granted and are returned.

Compare with llRequestPermissions and llGetPermissionsKey.