<xsl:value-of select="doc/assembly/name"/>

s ()


# https://sampwiki.blast.hk/wiki/sampwiki.blast.hk

Value

Syntax

Remarks

Members

Used by

Depends on

Attributes

Transition table

SourceTargetCondition

See Also

top

<>

Tag

Size

Returns

Defined in

, line

Example

  • #()
  • #()
  • Estimated stack usage

    cells

    Code size

    bytes

    Automaton

  • #()

  • ValueMacroOn foot GXTIn vehicle GXTOn foot defaultIn vehicle default
    0x1KEY_ACTION~k~~PED_ANSWER_PHONE~~k~~VEHICLE_FIREWEAPON_ALT~TABALT GR / LCTRL / NUM0
    0x2KEY_CROUCH~k~~PED_DUCK~~k~~VEHICLE_HORN~CH / CAPSLOCK
    0x4KEY_FIRE~k~~PED_FIREWEAPON~~k~~VEHICLE_FIREWEAPON~LCTRL / LMBLALT
    0x8KEY_SPRINT~k~~PED_SPRINT~~k~~VEHICLE_ACCELERATE~SPACEW
    0x10KEY_SECONDARY_ATTACK~k~~VEHICLE_ENTER_EXIT~~k~~VEHICLE_ENTER_EXIT~ENTERENTER
    0x20KEY_JUMP~k~~PED_JUMPING~~k~~VEHICLE_BRAKE~LSHIFTS
    0x40KEY_LOOK_RIGHT-~k~~VEHICLE_LOOKRIGHT~-E
    0x80KEY_HANDBRAKE/KEY_AIM~k~~PED_LOCK_TARGET~~k~~VEHICLE_HANDBRAKE~RMBSPACE
    0x100KEY_LOOK_LEFT-~k~~VEHICLE_LOOKLEFT~-Q
    0x140KEY_LOOK_BEHIND~k~~PED_LOOKBEHIND~~k~~VEHICLE_LOOKBEHIND~NUM1 / MMB2
    0x200KEY_SUBMISSION-~k~~TOGGLE_SUBMISSIONS~NUM1 / MMB2 / NUMPAD +
    0x400KEY_WALK~k~~SNEAK_ABOUT~-LALT-
    0x800KEY_ANALOG_UP-~k~~VEHICLE_TURRETUP~NUM8(3)NUM8
    0x1000KEY_ANALOG_DOWN-~k~~VEHICLE_TURRETDOWN~NUM2(3)NUM2
    0x2000KEY_ANALOG_LEFT~k~~VEHICLE_LOOKLEFT~~k~~VEHICLE_TURRETLEFT~NUM4NUM4
    0x4000KEY_ANALOG_RIGHT~k~~VEHICLE_LOOKRIGHT~~k~~VEHICLE_TURRETRIGHT~NUM6NUM6
    0x10000KEY_YES~k~~CONVERSATION_YES~~k~~CONVERSATION_YES~YY
    0x20000KEY_NO~k~~CONVERSATION_NO~~k~~CONVERSATION_NO~NN
    0x40000KEY_CTRL_BACK(1)~k~~GROUP_CONTROL_BWD~~k~~GROUP_CONTROL_BWD~HH
    -(2)-~k~~GROUP_CONTROL_FWD~~k~~GROUP_CONTROL_FWD~GG
    [-128,-1](4)KEY_UP(5)~k~~GO_FORWARD~~k~~VEHICLE_STEERUP~UPUP
    [1,128](4)KEY_DOWN(5)~k~~GO_BACK~~k~~VEHICLE_STEERDOWN~DOWNDOWN
    [-128,-1](4)KEY_LEFT(5)~k~~GO_LEFT~~k~~VEHICLE_STEERLEFT~LEFTLEFT
    [1,128](4)KEY_RIGHT(5)~k~~GO_RIGHT~~k~~VEHICLE_STEERRIGHT~RIGHTRIGHT

    Remarks

    • (1) Since 0.3d. Cannot be detected while the player is in spectator mode.
    • (2) Cannot be detected, GROUP_CONTROL_FWD is used to enter as passenger.
    • (3) Only detected when JOYPAD configuration is selected.
    • (4) These values can be read from the updown and leftright parameters when calling GetPlayerKeys.
    • (5) These macros only work with the most extreme value, players using analogue input can report any value within the given range.

    Remarks

    When using UpdateVehicleDamageStatus, the server will internally store the damage status without any checks and send it to the clients, but the clients will only (partially) apply the damage status depending on the vehicle. This means setting values using UpdateVehicleDamageStatus will be reported back when using GetVehicleDamageStatus but they may not have any effect in players' clients. See tables and notes below for support.

    The client usually keeps values that don't mean anything. For example, when setting the unused highest nibble of the panel state to 7 and the player damages the windshield, the panel value after the client reports the update would be 0x70020000.

    The client has two distinct ways of handling damage updates, depending on if all of panels,doors,lights are 0 or not (tires do not apply here because those are handled separately). If all values are 0, a game function is called that visually fixes the vehicle. If not all values are 0, a game function is called that applies visual damage. This may create weird side-effects when putting values back to 0 while not all values are 0. For example, setting a single panel state to 0 might remove dents in the panel but can still leave it hanging loosely. This is because only the function that fixes the vehicle will completely reset the visual damage.

    Some planes have an additional quirk when putting all of panels,doors,lights to 0 because the client calls a game function to visually fix an automobile, which is not supposed to be used on planes. This results in 'ghost door' effects on some planes, see Plane ghost doors on how to deal with this.

    Vehicle support

    Unsupported damage in the table below also means the damage will not be synced between clients.

    KindPanelsDoorsLightsTires
    Automobile(1)xxxx
    Motorcyclex
    Heli
    Boat
    Plane(2)xxx(3)
    Bike
    Train
    Trailer

    (1) following automobiles are excluded and do not sync damage at all: Dumper, Monster, Monster A, Monster B, Quadbike, Dune. All of these vehicles have bulletproof tires, except for the Quadbike. A player can shoot the tires of a Quadbike and they will be popped for the player driving the vehicle, but the tires will stay intact in the clients of all other players
    (2) plane damage status can be set (with UpdateVehicleDamageStatus), but clients will NOT report if damage changes. This means OnVehicleDamageStatusUpdate will NOT be called when a player damages their plane's engine/aileron/... and this damage will NOT be synced to other clients.
    (3) it is supported as in the client will apply it to the game vehicle, but it has no effect

    Panel states

    Each nibble contains the status of a different panel.

    MaskAutomobile usagePlane usage
    0x0000000Ffront leftleft engine(1)(2)
    0x000000F0front rightright engine(1)(2)
    0x00000F00rear leftrudder
    0x0000F000rear rightelevators(3)
    0x000F0000windshieldailerons(4)(5)
    0x00F00000front bumper(unused)
    0x0F000000rear bumber(unused)
    0xF0000000(unused)(unused)

    Individual nibble meaning:

    • 0x1 - is damaged
    • 0x2 - is very damaged (panel hangs loosely)
    • 0x3 - is removed(6)(7)

    (1) single-engine planes only use the left engine, setting the right engine status will have no effect
    (2) jet engines cannot be damaged (Shamal, Hydra, AT-400, Andromada)
    (3) if the plane has two separate elevators, this only damages the right elevator (but it will repair both when setting it to 0)
    (4) this only damages the right aileron, but setting it to 0 repairs both left and right
    (5) setting this back to 0 while not all of panels,doors,lights are set to 0 will functionally repair the ailerons (fixes the handling of the plane), but the ailerons may still look like they are damaged or slightly loose
    (6) plane panels do not get removed, they have another gradation of damaged
    (7) if this is a plane engine it will produce barely any thrust and most of the time even reverse thrust

    Door states

    Each byte contains the status of a different door.

    MaskAutomobile usagePlane usage
    0x000000FFhoodrudder(1)
    0x0000FF00trunkleft elevator(1)(2)
    0x00FF0000drivers doorpilot door(3)
    0xFF000000co-drivers doorco-pilot door

    The game holds state for 6 doors: hood, trunk, 2 front doors, 2 back doors. It's not possible to get or set the state of the back doors, their states are also not synced between clients.

    Individual byte meaning:

    • 0x1 - is opened(4)(5)
    • 0x2 - is damaged(6)
    • 0x4 - is removed

    (1) only value 0x4 has an effect: it will spawn a flying part (but the rudder/elevator will not actually be removed nor functionally damaged)
    (2) only applies to Stuntplane, Shamal, Hydra, Nevada, AT-400, Andromada
    (3) pilot doors can have a 'ghost door' effect on some models when fixing all damage, see Plane ghost doors below
    (4) extra plane passenger doors (for Beagle, Dodo, Skimmer) don't open
    (5) opening the driver's door will result in the driver immediately closing the door again
    (6) plane doors do not have damaged models, so these look like undamaged doors

    Light states

    MaskAutomobile/Motorcycle usage
    0x01front left broken
    0x04front right broken
    0x40rear both broken

    Tire states

    MaskAutomobile/Motorcycle usage
    0x1rear right popped
    0x2front right popped
    0x4rear left popped
    0x8front left popped

    Plane ghost doors

    Fixing the damage of a Rustler, Stuntplane, Shamal, Hydra, Nevada (unexpectedly not for the Cropduster) by doing UpdateVehicleDamageStatus(vehicleid, 0, 0, 0, 0) will cause a 'ghost door' effect: the pilot's door will show undamaged but the door will not open while the player does their enter/exit animation. To fix this, set the value of the pilot's door to 0x2 (damaged). The door will not show as damaged as there is no damaged model for them, but this will fix the enter/exit animation.

    This should also be done after calling RepairVehicle, as that internally works by using UpdateVehicleDamageStatus. Example fix:

    RepairVehicle(vehicleid);
    switch(GetVehicleModel(vehicleid)) {
    case 476: // Rustler
    case 513: // Stuntplane
    case 519: // Shamal
    case 520: // Hydra
    case 553: // Nevada
    	UpdateVehicleDamageStatus(vehicleid, 0, 0x20000, 0, 0);
    }