Технический форум Не получается забиндить функцию на кнопку
Parafin 08.06.2019 в 22:06

Пользователь

Репутация: 0 бал.

Замечания: 0 бал.


LSPD2gateMoving = false
LSPD2gateMoved = false
LSPD2Gate = createObject ( 3055, 2779.3999023438, -2342.6999511719, 164.10000610352)

function mv_func2( thePlayer, cmd, key, keyState )
local playeraccount = getPlayerAccount ( thePlayer )
local fac = getAccountData(playeraccount,"Faction") or 0
local accName = getAccountName (getPlayerAccount (thePlayer))
if getDistanceBetweenPoints3D ( 2779.3999023438, -2342.6999511719, 163.10000610352, getElementPosition ( thePlayer ) ) < 10 then
if getTeamName (getPlayerTeam (thePlayer)) == "Las Venturas Army"or isObjectInACLGroup ("user."..accName, aclGetGroup ("Admin")) then
if LSPD2gateMoving == false then
if LSPD2gateMoved == false then
moveObject ( LSPD2Gate, 4000, 2779.3999023438, -2342.6999511719, 159.39999389648, 0, 0, 0 )
LSPD2gateMoved = true
LSPD2gateMoving = true
setTimer(function()
LSPD2gateMoving = false
end, 3500,1)
else
moveObject ( LSPD2Gate, 4000, 2779.3999023438, -2342.6999511719, 164.10000610352, 0, 0, 0 )
LSPD2gateMoved = false
LSPD2gateMoving = true
setTimer(function()
LSPD2gateMoving = false
end, 3500,1)
end
end
end
end
end
bindKey("U", "down", mv_func2)
addCommandHandler ("gate", mv_func2)
addEventHandler("CommmandHandler", getRootElement(), mv_func2 )

LSPD2gateMoving = false
LSPD2gateMoved = false
LSPD2Gate = createObject ( 3055, 2779.3999023438, -2342.6999511719, 164.10000610352)

function mv_func2( thePlayer, cmd, key, keyState )
local playeraccount = getPlayerAccount ( thePlayer )
local fac = getAccountData(playeraccount,"Faction") or 0
local accName = getAccountName (getPlayerAccount (thePlayer))
if getDistanceBetweenPoints3D ( 2779.3999023438, -2342.6999511719, 163.10000610352, getElementPosition ( thePlayer ) ) < 10 then
if getTeamName (getPlayerTeam (thePlayer)) == "Las Venturas Army"or isObjectInACLGroup ("user."..accName, aclGetGroup ("Admin")) then
if LSPD2gateMoving == false then
if LSPD2gateMoved == false then
moveObject ( LSPD2Gate, 4000, 2779.3999023438, -2342.6999511719, 159.39999389648, 0, 0, 0 )
LSPD2gateMoved = true
LSPD2gateMoving = true
setTimer(function()
LSPD2gateMoving = false
end, 3500,1)
else
moveObject ( LSPD2Gate, 4000, 2779.3999023438, -2342.6999511719, 164.10000610352, 0, 0, 0 )
LSPD2gateMoved = false
LSPD2gateMoving = true
setTimer(function()
LSPD2gateMoving = false
end, 3500,1)
end
end
end
end
end
bindKey("U", "down", mv_func2)
addCommandHandler ("gate", mv_func2)
addEventHandler("CommmandHandler", getRootElement(), mv_func2 )
LordOri 09.06.2019 в 20:25

Проверенный

Репутация: 45 бал.

Замечания: 0 бал.

Parafin, что именно не получается?
jamrock 09.06.2019 в 20:50

Проверенный

Репутация: 8 бал.

Замечания: 0 бал.

Код нужно вставлять между ] и [
[ code] ЗДЕСЬ ТВОЙ КОД [ /code] (перед code и /code убрать пробелы)
fl4sh 12.06.2019 в 21:34

Пользователь

Репутация: 3 бал.

Замечания: 0 бал.


LSPD2gateMoving = false
LSPD2gateMoved = false
LSPD2Gate = createObject(3055, 2779.3999023438, -2342.6999511719, 164.10000610352)

function mv_func2(thePlayer, cmd, key, keyState)
local playeraccount = getPlayerAccount ( thePlayer )
local fac = getAccountData(playeraccount,"Faction") or 0
local accName = getAccountName (getPlayerAccount (thePlayer))
if getDistanceBetweenPoints3D ( 2779.3999023438, -2342.6999511719, 163.10000610352, getElementPosition ( thePlayer ) ) < 10 then
if getTeamName (getPlayerTeam (thePlayer)) == "Las Venturas Army" or isObjectInACLGroup ("user."..accName, aclGetGroup ("Admin")) then
if LSPD2gateMoving == false then
if LSPD2gateMoved == false then
moveObject ( LSPD2Gate, 4000, 2779.3999023438, -2342.6999511719, 159.39999389648, 0, 0, 0 )
LSPD2gateMoved = true
LSPD2gateMoving = true
setTimer(function()
LSPD2gateMoving = false
end, 3500,1)
else
moveObject ( LSPD2Gate, 4000, 2779.3999023438, -2342.6999511719, 164.10000610352, 0, 0, 0 )
LSPD2gateMoved = false
LSPD2gateMoving = true
setTimer(function()
LSPD2gateMoving = false
end, 3500,1)
end
end
end
end
end
addCommandHandler ("gate", mv_func2)

addEventHandler("onResourceStart", resourceRoot, function()
for index, allPlayers in ipairs( getElementsByType("player") ) do
bindKey(allPlayers, "U", "down", mv_func2)
end
end)

addEventHandler("onPlayerJoin", getRootElement(), function()
bindKey(source, "U", "down", mv_func2)
end)
Войдие или зарегистрируйтесь что бы написать сообщение