HU/getPedOccupiedVehicle

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ez a function visszaadja azt a járművet, amelyben a ped benne van, vagy amibe próbál beszállni.

Szintaxis

vehicle getPedOccupiedVehicle ( ped thePed )

OOP Syntax Help! I don't understand this!

Note: Set the variable to nil to execute removePedFromVehicle
Method: ped:getOccupiedVehicle(...)
Variable: .vehicle
Counterpart: warpPedIntoVehicle


Kötelező paraméterek

  • thePed: A ped, akinek a járművét keressük.

Visszatérési érték

Visszaadja azt a járművet, amelyben a ped benne van, vagy false, ha a ped nincs benne a járműben, vagy érvénytelen a ped.

Példa

Amikor egy ped beírja a 'getcarname' parancsot, és egy járműben ül, akkor ez a példa kiírja a jármű nevét.

function showVehicleName ( thePlayer )
   local theVehicle = getPedOccupiedVehicle ( thePlayer )
   if theVehicle then
      outputChatBox ( "Name of the Vehicle: " .. getVehicleName ( theVehicle ), thePlayer )
   else
      outputChatBox ( "You do not have a Vehicle!", thePlayer, 255, 0, 0, true )
   end
end
addCommandHandler ( "getcarname", showVehicleName )

Lásd még

Fordította