AR/getElementHealth: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Server client function}} __NOTOC__ هذه الوظيفة تقول بجلب دم الالمنت اوالشيئ. ==Syntax== <syntaxhighlight lang="lua"> float getElementHealth ( element the...")
(No difference)

Revision as of 17:52, 9 February 2016

هذه الوظيفة تقول بجلب دم الالمنت اوالشيئ.

Syntax

float getElementHealth ( element theElement )

OOP Syntax Help! I don't understand this!

Method: element:getHealth(...)
Variable: .health


شرح الارقمنتات

  • theElement: الالمنت = الاعب او السيارة الذي تريد جلب دمها.


مثال

Click to collapse [-]
Clientside example

هذا المثال عند كتابة كلمة باف8 يجلب دم الاعب + السيارة بالشات.

function showLocalHealth()
	--نقول بجلب دم الاعب
	local playerHealth = getElementHealth ( localPlayer )
	outputChatBox ( "Your health: " .. playerHealth ) --نخرج كلام بالشات بعدد الدم

	--نقوم بجلب دم السيارة
	local playerVehicle = getPedOccupiedVehicle ( localPlayer )
	if playerVehicle then
		local vehicleHealth = getElementHealth ( playerVehicle ) / 10 
		outputChatBox ( "Your vehicle's health: " .. vehicleHealth ) --نخرج كلام بالشات بدم السيارة
	end
end
addCommandHandler ( "showhealth", showLocalHealth )--عند الكتابة باف8

See Also

Shared