HU/getPedControlState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function hu}} Checks whether a ped has a certain control pressed. ==Szintaxis== <syntaxhighlight lang="lua"> bool getPedControlState ( ped thePed, string c...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function hu}}
{{Client function hu}}
Checks whether a ped has a certain control pressed.
Ellenőrzi, hogy a ped lenyomott-e egy bizonyos irányítást.


==Szintaxis==
==Szintaxis==
Line 7: Line 7:
bool getPedControlState ( ped thePed, string control )
bool getPedControlState ( ped thePed, string control )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[Ped]]:getControlState}}


===Kötelező paraméterek===
===Kötelező paraméterek===
*'''thePed:''' the ped you want to check.
*'''thePed:''' a ped, akit ellenőrizni szeretne.
*'''control:''' the control to get the status of. See [[control names]] for a list of valid names.
*'''control:''' az irányítás, aminek az állapotát szeretnéd. Lásd [[control names]] az érvényes nevek listájához.


===Visszatérési érték===
===Visszatérési érték===
Returns ''true'' if the ped is pressing the specified control, ''false'' if not or an invalid argument was passed.
Visszatérési értéke ''true'', ha a ped a megadott irányítást nyomja meg, ''false'', ha nem, vagy ha érvénytelen paraméter lett megadva.


===Példa===
===Példa===
Line 47: Line 48:


==Lásd még==
==Lásd még==
{{Client ped functions}}
{{Client ped functions hu}}


[[en:getPedControlState]]
[[en:getPedControlState]]

Latest revision as of 22:48, 5 November 2018

Ellenőrzi, hogy a ped lenyomott-e egy bizonyos irányítást.

Szintaxis

bool getPedControlState ( ped thePed, string control )

OOP Syntax Help! I don't understand this!

Method: Ped:getControlState(...)


Kötelező paraméterek

  • thePed: a ped, akit ellenőrizni szeretne.
  • control: az irányítás, aminek az állapotát szeretnéd. Lásd control names az érvényes nevek listájához.

Visszatérési érték

Visszatérési értéke true, ha a ped a megadott irányítást nyomja meg, false, ha nem, vagy ha érvénytelen paraméter lett megadva.

Példa

Click to collapse [-]
Client
local controlTable = {"forwards", "backwards", "left", "right", "jump", "crouch"}

function invisibleOnSpawn()
    setElementAlpha (localPlayer, 0)
    checkControlState = setTimer(controlState, 50, 0)
end
addEventHandler ("onClientPlayerSpawn", localPlayer, invisibleOnSpawn)

function controlState()
    for i,control in ipairs(controlTable) do
        local state = getPedControlState(localPlayer, control)
	if (state) then
	    setElementAlpha (localPlayer, 255)
	    if (isTimer(checkControlState)) then
		killTimer(checkControlState)
		checkControlState = nil
	    end 
	end
    end
end

Changelog

Version Description
1.5.5-3.11427 Works with the local player as well. Deprecated setControlState and getControlState.

Lásd még

Fordította