Prosz?, "troche" poprawi?em kod nie testowa?em lecz powinno dzia?a?
local bramy = {
--{kordy bramy, rot bramy, kordy markeru, aclgrup}
{-127.40, 1033.90, 20.79, 90, -124.50101, 1035.11816, 19, "OSP"},
}
local maks = 0
for i, v in ipairs(bramy) do
brama = createObject(5422, v[1], v[2], v[3], 0, 0, v[4])
marker = createMarker(v[5], v[6], v[7], "cylinder", 1.5, 255, 0, 0, 255)
setElementData(marker, "frakcja", v[8])
setElementData(marker, "kordy", v[1]..","..v[2]..","..v[3])
addEventHandler("onMarkerHit", marker, markerHit)
addEventHandler ( "onMarkerLeave", marker, markerLeave)
maks = maks+1
end
function markerHit(player)
if getElementType(player) == "player" then
local gracz = getPlayerName(player)
local konto = getAccountName(getPlayerAccount(player))
if isObjectInACLGroup( 'user.'..konto, aclGetGroup(getElementData(source, "frakcja"))) then
local kordy = split(getElementData(source, "kordy"), ",")
moveObject(5422, 10000, kordy[1], kordy[2], kordy[3]-4)
outputChatBox("Otworzy?e? brame", player, 0, 255, 255)
end
end
end
function markerLeave(hitPlayer)
if getElementType(player) == "player" then
local gracz = getPlayerName(player)
local konto = getAccountName(getPlayerAccount(player))
if isObjectInACLGroup( 'user.'..konto, aclGetGroup(getElementData(source, "frakcja"))) then
local kordy = split(getElementData(source, "kordy"), ",")
moveObject(5422, 10000, kordy[1], kordy[2], kordy[3]+4)
outputChatBox("Zamkn??e? brame", player, 0, 255, 255)
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------
-- @name: System Bram
-- @author: LuKiO
-- @date: 11-08-2015
-- @version: 1.0.0
-- @info: Zakaz zmiany autora skryptu
-- @For: Gtao.pl
---------------------------------------------------------
bramy = {}
bramy[1] = {x=xxx, y=xxx, z=xxx, z2=xxx, rot=xxx, id=xxx, rozmiar=xxx, acl=xxx }
----*xxx - wype?niij
----Przyk?ad
----bramy[1] = {x=-1631.8000488281, y=688.40002441406, z=8.6999998092651, z2=3, rot=270, id=10184, rozmiar=10, acl="Policja" }
data = {}
data.max = 1 --//Ilosc bram
brama = {} --//Tabela bram
maker = {} --//Tabela marker?w
function createBrama () --Tworzenie bram
for i=1, data.max do --P?tla do pobierania ilosci bram
brama[i] = createObject ( 5422, -127.40, 1033.90, 20.79, 0, 0, 90) --//Tworzebie objektu(Brama)
maker[i] = createMarker(-124.50101, 1035.11816, 19, 'cylinder', 1.5, 0, 255, 0, 75) --//Tworzebie Markeru
outputDebugString( "Storzono brame o id "..i)
end
end
addEventHandler( "onResourceStart", getRootElement(), createBrama)
function Wjedz(hitPlayer) --Wchodzenie do bramy
for i=0, data.max do --P?tla do pobierania ilosci bram
if source == maker[i] then --Sprawdzanie czy marker jest markerem bramy
if getElementType( hitPlayer ) == "player" then --Sprawdzanie czy element w markerze to gracz
local gracz = getPlayerName( hitPlayer ) -- Pobieranie Nazwy gracza
local konto = getAccountName( getPlayerAccount( hitPlayer ) ) --Pobieranie Loginu gracz
if isObjectInACLGroup( 'user.'..konto, aclGetGroup("OSP") ) then --Sprawdzenie czy gracz znajduje si? w acl
moveObject ( 5422, 10000, 127.40, 1033.90, 16.40)
outputChatBox( "● Otworzy?e? brame o id: "..i, hitPlayer, 0,255,255, true)
outputDebugString( "Otwieranie bramy o id "..i.." przez "..gracz.."" )
end
end
end
end
end
addEventHandler ( "onMarkerHit", getRootElement(), Wjedz )
function Wyjedz(hitPlayer) -- Wychodzenie z bramy
for i=0, data.max do --P?tla do pobierania ilosci bram
if source == maker[i] then --Sprawdzanie czy marker jest markerem bramy
if getElementType( hitPlayer ) == "player" then --Sprawdzanie czy element w markerze to gracz
local gracz = getPlayerName( hitPlayer ) -- Pobieranie Nazwy gracza
local konto = getAccountName( getPlayerAccount( hitPlayer ) ) --Pobieranie Loginu gracz
if isObjectInACLGroup( 'user.'..konto, aclGetGroup(bramy[i].acl) ) then --Sprawdzenie czy gracz znajduje si? w acl
moveObject ( 5422, 10000,-127.40, 1033.90, 20.79, 0, 0, 90)
outputChatBox( "● Zamkn??e? brame o id: "..i, hitPlayer, 0,255,255, true)
outputDebugString( "Zamkni?cie bramy o id "..i.." przez "..gracz.."" )
end
end
end
end
end
addEventHandler ( "onMarkerLeave", getRootElement(), Wyjedz )
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach