A class is a group of commands applied to the in-game entities: player, peds, objects, etc. For example, the
Playerclass groups the commands performed over the player character.
<Class name>.<Class member>(parameters)
Class name- the name of a group of commands defined in the
classes.dbfile for this edit mode
Class member- one of the commands included in the class
Parameters- 0 or more comma-delimited parameters
Player- class name
SetMinWantedLevel- class member
$PLAYER_CHAR, 2- two parameters for
There are three types of class members:
Methods are regular commands used to complete a single in-game action, e.g. moving an object, destroying a vehicle, etc.:
Object.PutAt($crate, 10.0, -25.5, 12.2)
They are marked with the work
procin the list of class members.
A special kind of methods is a constructor. A constructor creates a new instance of a class and stores its handle to a variable.
In Sanny Builder the constructor can be written in two equivalent ways:
Player.Create($PLAYER_CHAR, #NULL, 2488.5601, -1666.84, 13.38)
$PLAYER_CHAR = Player.Create(#NULL, 2488.5601, -1666.84, 13.38)
Property allows you to access class attributes and/or modify them.
For example, the
.Moneyproperty of the
Playerclass allows to operate with the amount of money of the player:
Almost all class members take a variable as the first parameter. This variable holds a handle of the class instance which is a concrete in-game entity the command is applied to:
$PLAYER_CHAR- the class instance.
For some in-game entities there is only one instance to exist. An example of that would be the camera that controls what the player can see. The members of classes for such entities do not require a variable with the class instance:
It instructs the compiler that
$PLAYER_CHARholds an instance of the class
Player. This variable can serve as an alias to the class name:
Variables declared as instances of a class can be redeclared with another type.
It is equivalent to:
Player.SetClothes($PLAYER_CHAR, "VEST", "VEST", BodyPart.Torso)
The last parameter (
BodyPart.Torso) is a member of the
BodyPartenum substituted with
0during compilation. The enums and values are defined in the
Sanny Builder prior to v3.6 defined special constants for class members in the file
classes.db. These parameters were called extended. This solution only allowed for one extended parameter per class member.
Since v3.6 class members use enum names as their types and may have any number of enumerated parameters.
For backward compatibility Sanny Builder still supports old extended parameters during compilation.
classes.dbkeeps them under the