HU/fadeCamera

From Multi Theft Auto: Wiki
Revision as of 13:36, 13 August 2018 by Surge (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Ez a function egy játékos kameráját színesre állítja, vagy vissza normálisra egy meghatározott időtartam alatt. Valamint, ez befolyásolja a hangerőt is (50% faded = 50% hangerő, full fade = nincs hang). For clientside scripts you can perform 2 fade ins or fade outs in a row, but for serverside scripts you must use one then the other.


[[{{{image}}}|link=|]] Megjegyzés: Az effect sebessége közvetlenül a jelenlegi játéksebességétől függ.

Szintaxis

Click to collapse [-]
Server
bool fadeCamera ( player thePlayer, bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )

OOP Syntax Help! I don't understand this!

Method: player:fadeCamera(...)


Kötelező paraméterek

  • thePlayer: A játékos, melynek a kameráját szeretné állítani.
  • fadeIn: Should the camera be faded in or out? Pass true to fade the camera in, false to fade it out to a color.

Tetszőleges paraméterek

  • timeToFade: The number of seconds it should take to fade. Any number less than 1 makes the fade instant.
  • red: The amount of red in the color that the camera fades out to (0 - 255). Not required for fading in.
  • green: The amount of green in the color that the camera fades out to (0 - 255). Not required for fading in.
  • blue: The amount of blue in the color that the camera fades out to (0 - 255). Not required for fading in.
Click to collapse [-]
Client
bool fadeCamera ( bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )

OOP Syntax Help! I don't understand this!

Method: Camera.fade(...)


Kötelező paraméterek

  • fadeIn: Should the camera be faded in our out? Pass true to fade the camera in, false to fade it out to a color.

Tetszőleges paraméterek

  • timeToFade: The number of seconds it should take to fade. Any number less than 1 makes the fade instant.
  • red: The amount of red in the color that the camera fades out to (0 - 255). Not required for fading in.
  • green: The amount of green in the color that the camera fades out to (0 - 255). Not required for fading in.
  • blue: The amount of blue in the color that the camera fades out to (0 - 255). Not required for fading in.

Visszatérési érték

Visszatérési értéke true, ha a camera sikeresen meg lett változtatva, false ha érvénytelen paraméterek lettek megadva.

Példa

Click to collapse [-]
Server example

Ha a játékost sérülés éri, egy gyors fade-to-red effect-et helyez a képernyőre.

function addRednessOnDamage ( )
      fadeCamera ( source, false, 1.0, 255, 0, 0 )         -- fade the player's camera to red over a period of 1 second
      setTimer ( fadeCameraDelayed, 500, 1, source )   -- don't let it go to opaque red, interrupt it after half a second and fade back to normal
end
addEventHandler ( "onPlayerDamage", root, addRednessOnDamage )

function fadeCameraDelayed(player) -- This function prevents debug warnings when the player disconnects while the timer is running.
      if (isElement(player)) then
            fadeCamera(player, true, 0.5)
      end
end

Lásd még

Fordította

  • Surge