marker = createMarker ( 226.4, 1873.5, 15.4, "cylinder", 5, 0, 0, 0 )
local doorState = true
local x1,y1,z1 = 226.4, 1873.5, 15.4
local x2,y2,z2 = 226.4, 1871.5, 15.4
chinaTgate = createObject ( 2930, x1,y1,z1)
function op()
moveObject ( chinaTgate, 2000, x2,y2,z2)
end
function cl()
moveObject ( chinaTgate, 800, x1,y1,z1 )
end
function checkAdmin(player,key,state)
if ( state == "down" ) then
local accName = getAccountName(getPlayerAccount(player))
local isAdmin = isObjectInACLGroup ("user."..accName, aclGetGroup ( "King-abady" ) )
if ( isAdmin ) then
if ( doorState ) then
op()
else
cl()
end
doorState = not doorState
end
end
end
function onStart ( )
for i,v in ipairs(getElementsByType( "player" )) do
bindKey(v,"X","down",checkAdmin)
end
end
addEventHandler ( "onResourceStart", getResourceRootElement(), onStart )
function onJoin()
bindKey(source,"X","down",checkAdmin)
end
addEventHandler ( "onPlayerJoin", getRootElement(), onJoin)
addEventHandler("onClientMarkerHit", marker,
function ( )
checkAdmin ()
end
)
addEventHandler("onClientMarkerLeave", marker,
function ( )
checkAdmin ()
end
)
ما جربته