scripting:reference:system_functions:playerstatusfunctions
This is an old revision of the document!
Table of Contents
Player Status Functions
System functions that provide you information about the player
sysGetNearestPlayer
| Format | sysGetNearestPlayer( [WorldX], [WorldY] ) |
|---|---|
| Description | Returns the ID of the player closest to the specified world coordinate |
| Parameters | World Coordinate X,Y |
| Returns | Player ID |
Example:
$kSpecialBuildingRecordNum = 10
Event( "UseItem", "Plunger" )
{
SetBuildingContext( $kSpecialBuildingRecordNum )
$posX = $gBuildingWorldX
$posY = $gBuildingWorldY
$targetPlayerID = sysGetNearestPlayer( $posX, $posY )
$targetPlayerName = sysGetPlayerName( $targetPlayerID )
*say %PLAYER% used the plunger. The person closest to the special building was $targetPlayerName
*explodebuilding $kSpecialBuildingRecordNum
}
sysGetPlayerID
| Format | sysGetPlayerID( [Player Name] ) |
|---|---|
| Description | Returns the ID for a specified player name |
| Parameters | Player Name |
| Returns | Player ID |
Example:
Event( "Custom", "Special" )
{
$playerID = sysGetPlayerID( "Bob" )
if ( $playerID <= 0 )
{
*msg %PLAYER% Bob doesn't exist on this world
}
else
{
*msg %PLAYER% Bob's player ID is $playerID
}
}
sysIsPlayerIDOnline
| Format | sysIsPlayerIDOnline( [Player ID] ) |
|---|---|
| Description | Used to determine if the specified player is currently online on the world |
| Parameters | Player ID |
| Returns | 1 if the player is connected, 0 if not |
| Example | $isOnline = sysIsPlayerIDOnline(32) |
sysIsInSpawnZone
| Format | sysIsInSpawnZone( [SpawnZone Type/ID] ) |
|---|---|
| Description | Used to determine if the current player is within the specified spawn zone region |
| Parameters | SpawnZone Type/ID |
| Returns | 1 if the player is in the region, 0 if not |
| Example | $isInDefaultSpawnZone = sysIsInSpawnZone(0) |
sysIsInTown
Example : $var = sysIsInTown(“Home Town”))
Returns 1 if the current player is within the boundaries of the specified town, 0 if not
sysNumPlayersOnTeam
Example : $var = sysNumPlayersOnTeam(3)
Returns the number of players currently online and in the specified team
sysPlayerInventory
| Format | sysPlayerInventory ( [Item] ) |
|---|---|
| Description | Returns the number of an item the current player currently posesses |
| Parameters | [Item] - Name or number of the item |
| Returns | Amount carried |
Example:
Event( "PreAccessBuilding", "10" )
{
$hasKeys = sysPlayerInventory( "Keys" )
if ( $hasKeys == 0 )
{
*msg %PLAYER% You cannot access this building without keys
CancelTransaction()
}
}
sysPlayerSkillLevel
Example : $var = sysPlayerSkillLevel(“Farmer”)
Returns the current player's skill level for the skill named (0 means the player does not yet have this skill)
sysPlayerIsLearningSkill
Example : $isLearning = sysPlayerIsLearningSkill(“Farmer”)
Returns 1 if the player is currently learning the specified skill, 0 if not.
scripting/reference/system_functions/playerstatusfunctions.1580299734.txt.gz · Last modified: (external edit)
