HU/addPedClothes: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 21: Line 21:
==Példa==
==Példa==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
Ez a példa egy 'moto' sisakot rak egy játékosra, amikor egy nrg-ra ül fel, majd eltávolítja, ha leszáll róla.
Ez a példa egy 'moto' sisakot rak egy játékosra, amikor egy nrg-ra ül fel, majd eltávolítja azt, ha leszáll róla.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onEnterVehicle ( theVehicle, seat, jacked )
function onEnterVehicle ( theVehicle, seat, jacked )

Revision as of 21:40, 17 September 2018

[[{{{image}}}|link=|]] Note: Ez a function egyedül csak a CJ skinnel működik (ID 0).

This function is used to set the current clothes on a ped.

Szintaxis

bool addPedClothes ( ped thePed, string clothesTexture, string clothesModel, int clothesType )

OOP Syntax Help! I don't understand this!

Method: ped:addClothes(...)
Counterpart: getPedClothes


Kötelező paraméterek

  • thePed: A gyalogos, akinek a ruháját meg akarjuk változtatni.
  • clothesTexture: A string determining the clothes texture that will be added. See the clothes catalog.
  • clothesModel: A string determining the clothes model that will be added. See the clothes catalog.
  • clothesType: A integer representing the clothes slot/type the clothes should be added to. See the clothes catalog.

Visszatérési érték

Visszatérési értéke true, ha a ruhák sikeresen hozzá lettek adva a gyalogoshoz, egyébként false.

Példa

Click to collapse [-]
Server

Ez a példa egy 'moto' sisakot rak egy játékosra, amikor egy nrg-ra ül fel, majd eltávolítja azt, ha leszáll róla.

function onEnterVehicle ( theVehicle, seat, jacked )
    if getElementModel ( theVehicle ) == 522 then         -- if it's an nrg
        addPedClothes ( source, "moto", "moto", 16 )   -- add the helmet
    end
end
addEventHandler ( "onPlayerVehicleEnter", root, onEnterVehicle )

function onExitVehicle ( theVehicle, seat, jacked )
    if getElementModel ( theVehicle ) == 522 then      -- if it's an nrg
        removePedClothes ( source, 16 )              -- remove the helmet
    end
end
addEventHandler ( "onPlayerVehicleExit", root, onExitVehicle )

Lásd még

Shared



Fordította