HU/getPedControlState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
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 billentyűt.


==Szintaxis==
==Szintaxis==
Line 9: Line 9:


===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:''' a billentyű, hogy megkapja az állapotát. 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 billentyűt nyomja meg, ''false''ha nem, vagy ha érvénytelen pareméter lett megadva.


===Példa===
===Példa===

Revision as of 17:38, 8 October 2018

Ellenőrzi, hogy a ped lenyomott-e egy bizonyos billentyűt.

Szintaxis

bool getPedControlState ( ped thePed, string control )

Kötelező paraméterek

  • thePed: a ped, akit ellenőrizni szeretne.
  • control: a billentyű, hogy megkapja az állapotát. 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 billentyűt nyomja meg, falseha nem, vagy ha érvénytelen paremé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