Witam, mam problem z poprawnym zamknięciem bramy po wcześniejszym wyjściu z cuboida. Na początku brama otwiera się poprawnie, lecz gdy wjadę wyjadę i znowu wjadę przed zakończeniem wcześniejszej animacji brama nie wraca do podstawowej pozycji. Kod
Hej mam taki kod i nie wiem czemu gdy wchodz? w marker to gui wyswietla sie dla wszystkich graczy czy moglby ktos napisac aby wyswietlalo sie tylko dla gracza, ktory wszedl w marker?
[code]
local screenW, screenH = guiGetScreenSize()
local sx, sy = guiGetScreenSize()
local w, h = (sx/1280),(sy/720)
Cze??, zrobi?em skrypt na bram? i nie dzia?a. Ni?ej podam skrypt i meta bo nie robi? skrypt?w na co dzie? i nie wiem czy jest dobrze, ale nie wiem czy musz? mie? plik MAP, ?eby usun?? poprzedni? map?. Prosz? o pomoc.
Mam pytanie, jak zrobi? co? w dzia?aniu jak brama na item, czyli np
Tworzy sie brame ( createObject ), je?li gracz kliknie przycisk w CGUI to ona sie obni?y za pomoc? moveObject i item zostanie zabrany, item ma elementdate
setElementData(argument1, "Winter Card" tutaj jest np +1 lub -1)
Czesc od dluzszego czasu probuje zrobic brame z db
Brama = createObject (9625, -2439.39, 758.7, 36, 0, 0, 90)
function OtworzBrame ()
if getElementData(thePlayer, "player:duty") == PSP then
moveObject ( Brama, 1000, -2439.39, 758.7, 30 ) end
end
addCommandHandler("od", OtworzBrame )
function ZamknijBrame ()
if getElementData(thePlayer, "player:duty") == PSP then
moveObject ( Brama, 1000, -2439.39, 758.7, 36 ) end
end
addCommandHandler("zd", ZamknijBrame )
i co dodac jakie linijki gdzie jak zdefinowac thePlayer?
nie dawno by?em tutaj zeby brama by?a pod element date PSP na swoim serwerze na kt?rym skryptuje.
Dosta?em taki kod
Brama = createObject (9625, -2439.39, 758.7, 36, 0, 0, 90)
function OtworzBrame ()
if getElementData(thePlayer, "player:duty") == PSP then
moveObject ( Brama, 1000, -2439.39, 758.7, 30 ) end
end
addCommandHandler("od", OtworzBrame )
function ZamknijBrame ()
if getElementData(thePlayer, "player:duty") == PSP then
moveObject ( Brama, 1000, -2439.39, 758.7, 36 ) end
end
addCommandHandler("zd", ZamknijBrame )
i mi nie dzia?a poniewa? chcia?em ?eby ta brama by?a dla gracza o frakcji PSP tylko ?e frakcja to jest duty
potrzebuje aby kto? zmodyfikowa? moj? brame tak aby dzia?a?a dla wszystkich odo skrypt:
local Sciana = createObject( 980, -1754.1999511719, -116.30000305176, 0.89999997615814, 0, 0, 90)
local Marker = createMarker(-1754.1999511719, -116.30000305176, 3, "cylinder", 9.0, 1 , 1 , 1 , 155)
function otworzbrame(plr)
if isElement( plr ) and getElementType( plr ) == "player" then
moveObject (Sciana, 2000, -1754.1999511719, -116.30000305176, 0.89999997615814)
return end
end
addEventHandler("onMarkerHit", Marker, otworzbrame)
function zamknijbrame(plr)
if isElement( argunent ) and getElementType( argument ) == "player" then
moveObject (Sciana, 2000, -1754.1999511719, -116.30000305176, 0.89999997615814)
return end
end
addEventHandler( "onMarkerLeave", Marker, zamknijbrame)
Cze??, wiecie mo?e jak usun?? bram? kt?ra jest pokazana na SS, nie da si? jej usun?? - "usuwatorem obiekt?w", na innym serwerze widzia?em ?e owej bramy nie ma... Wie kto? co na to poradzi??
Czesc zrobilem sobie brame na klawisz i nie dziala ona tak jak powinna, otoz po wcisnieciu klawisza otwiera sie ale juz nie moge jej zamknac i nic z ni? zrobic, wie kto? jak to naprawi??
na moim serwerze nie dziala brama
ta pierwsza dziala ale ta druga juz nie(ta druga z dopiskiem 1 nie dziala)
[lua]
local gate={
-- var
object=createObject(969, 1544.70,-1630.85,12.51,0,0,90),
marker=createMarker(1544.29,-1626.99,13.38-1, "cylinder", 9, 0, 0, 0, 0),
close=true,
animation=false,
}
gate.open=function()
if gate.animation or not gate.close then return end
cze?c,Mam problem Poniewa? zrobi?em brame na acl do frakcji sapd ale okaza?o sie ?e frakcja sapd jest pod mysql jak zreszt? ca?a paczka mo?e kto? mi pom?c zrobi? brame pod mysql???
function isPlayerInPoliceFaction(plr)
local sid=getElementData(plr,'player:uid')
if not sid then return end
local result=exports['ogrpg-db']:dbGet('SELECT 1 FROM ogrpg_factions WHERE code=? AND sud=? LIMIT 1;', "SAPD", uid)
if result[1] then
return true
else
return false
end
end
addEventHandler("onMarkerHit", marker1, function(el)
if not isPlayerInPoliceFaction(el) then return end
local px, py, pz = getElementPosition(door1)
moveObject(door1, 2000, px+2, py, pz)
end)
addEventHandler("onMarkerLeave", marker1, function(el)
if not isPlayerInPoliceFaction(el) then return end
moveObject(door1, 2000, -50.099609375, 30.900390625, 980.90002441406)
end)
addEventHandler("onMarkerHit", marker2, function(el)
if not isPlayerInPoliceFaction(el) then return end
local px, py, pz = getElementPosition(door2)
moveObject(door2, 2000, px+2, py, pz)
end)
local brama1 = createObject(980,281.87, 1460.66, 1341.77, 0, 0 ,90)
function otworz(plr)
if getElementData(plr, "frakcja") then
moveObject(brama1,5000,281.87, 1460.66, 1330.77) outputChatBox("* Trwa otwieranie celi nr 1...",plr,0,255,0) end
end function zamknij(plr)
if getElementData(plr, "frakcja") then
moveObject(brama1,5000,281.87, 1460.66, 1341.77) outputChatBox("* Trwa zamykanie celi nr 1...",plr,255,0,0) end
end
addCommandHandler('o',otworz) addCommandHandler('z',zamknij)
Blad w DB3:
bad argument @ 'getElementData' [Expected element at argument 1, got string 'z'
Witam mam bardzo prosty problem ale tak dawno tego nie robi?em ?e si? zapomnia?o.
Ot?? brama na ACL nie dzia?a w og?le si? nawet nie pojawia
Brama = createObject (2933, -1571.8, 661.70, 7.90, 0, 0, 90)
function OtworzBrame ()
if not getPlayerAccount(plr) then return end
local accName = getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja") ) then
moveObject ( Brama, 10000, -1571.8, 671, 7.90 ) addCommandHandler("otworzpoli2", OtworzBrame ) end
function ZamknijBrame ()
if not getPlayerAccount(plr) then return end
local accName = getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja") ) then
moveObject ( Brama, 10000, -1571.8, 661.70, 7.90 ) addCommandHandler("zamknijpoli2", ZamknijBrame ) end
Siema zrobi?em wszystko dobrze i powinno dzia?a ale c?? co? musia?o si? sta? i nie wiem co jest ?le.
Za pomoc postawie piwo
Serwer:
function isPlayerInFaction1(plr) local sid=getElementData(plr,'player:sid')
if not sid then return end
local result=exports['pystories-db']:dbGet('SELECT 1 FROM pystories_factions WHERE code=? AND sid=? LIMIT 1;', "SARA", sid)
if result[1] then return true else
return false
end
end
local bramaSARA = createObject(971, -489.29,-562.46,25.52, 0, 0, 180) local bramaSARAm = createMarker(-488.72,-561.89,25.52, "cylinder", 8, 255, 255, 255, 0)
addEventHandler("onMarkerHit", bramaSAPD, function(el)
if not isPlayerInFaction1(el) then return end
local px, py, pz = getElementPosition(bramaSARA) moveObject(bramaSARA, 4000, px, py, pz-15) end)
addEventHandler("onMarkerLeave", bramaSAPDm, function(el)
if not isPlayerInFaction1(el) then return end
moveObject(bramaSARA, 4000, -488.72,-561.89,25.52) end)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("Everyone")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("Moderator")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("SuperModerator")) then
moveObject ( brama1, 2500, 2487.80640,-1669.21960,13.3359-7) addCommandHandler("o", MarkerHit1 ) end
end
end
function MarkerLeave1 (thePlayer) moveObject ( brama1, 2500, 2487.80640,-1669.21960,13.3359) end
Niestety mam problem ze skryptem ot?? po prostu nie dzia?a w db3 nic kod
[lua]
--]] Autor skryptu: Patrix
--W bindach pomaga?: Atex
--W animacji pomaga?: Emm
--Zakaz zmiany autora![[--
bm = createMarker(-2305.70557, -157.99330, 34.26875, "cylinder", 1.0, 0, 0, 0, 255) -- gdzie ma byc marker w ktorym bedzie sie scrollowac
d = createObject (5856, -2306.5, -155.39, 36.40, 0, 0, 0) -- podajesz koordy obiektu
local kategoria_animacji = "CRIB"
local animacja = "CRIB_Use_Switch"
function od ( thePlayer)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then --Tutaj zmieniasz tylko "Policja"
moveObject ( d, 10000, -2306.5, -155.39, 32.20 ) -- Koordy otwartych drzwi
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
setPedAnimation(thePlayer,kategoria_animacji,animacja,true,false,false)
end
end
end
function zd ( thePlayer)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then --Tutaj zmieniasz tylko "Policja"
moveObject ( d, 10000,-2306.5, -155.39, 36.40) -- koordy zamknietych drzwi
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
setPedAnimation(thePlayer,kategoria_animacji...
function Otwieranie(thePlayer)
if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Policja")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("LiderPolicja")) then
if getPlayerTeam(player) == getTeamFromName("Policja") then
moveObject(Brama, 980, 1588.06738, -1637.92737, 9.42048)
end
end
end
addEventHandler("onResourceStart", root, function()
for k,v in ipairs(getElementsByType("player")) do
bindKey(v, "e", "down", Otwieranie)
end
end)
function Zamykanie(thePlayer)
if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Policja")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("LiderPolicja")) then
if getPlayerTeam(player) == getTeamFromName("Policja") then
moveObject(Brama, 980, 1588.06738, -1637.92737, 14.42048)
end
end
end
addEventHandler("onResourceStart", root, function(
for k,v in ipairs(getElementsByType("player")) do
bindKey(v, "r", "down", Zamykanie)
end
end[/lua]
wyskakuje w debugscript 3: [code]ERROR: Loading script failed: brama_sapdbrama.lua:29: <name> or '..." expected near 'for'[/c...
Witam chcia? bym kod na brame dla grupy w ACL. Chodzi mi o takie cos ze gracz z danej grupy wpisuje /open to sie otwiera a jak gracz kt?ry nie jest w grupie to sie nie otwiera z g?ry dzieki
Witam nie dzia?a mi brama. Ot?? pojawia si? marker ale nie dzia?a w nim scrolowanie
ZA POMOC I
KOD
[lua]
--]] Autor skryptu: Patrix
--W bindach pomaga?: Atex
--W animacji pomaga?: Emm
--Zakaz zmiany autora![[--
bm = createMarker(-2305.39233, -152.57820, 34.46875, "cylinder", 1.0, 0, 0, 0, 255) -- gdzie ma byc marker w ktorym bedzie sie scrollowac
d = createObject (5422,-2306.60, -149.80, 36.40, 0, 0, 0) -- podajesz koordy obiektu
local kategoria_animacji = "CRIB"
local animacja = "CRIB_Use_Switch"
function od ( thePlayer)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then --Tutaj zmieniasz tylko "Policja"
moveObject ( d, 10000, -2306.60, -149.80, 31.89 ) -- Koordy otwartych drzwi
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
setPedAnimation(thePlayer,kategoria_animacji,animacja,true,false,false)
end
end
end
function zd ( thePlayer)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then --Tutaj zmieniasz tylko "Policja"
moveObject ( d, 10000,-2306.60, -149.80, 36.40) -- koordy zamknietych drzwi
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
...
function OtwieranieZamykanie(el, md)
if openclose == true then
openclose = false
moveObject(drzwi, 2000,-2422.31,-649.55, 135.05) --otwieranie drzwi
else
openclose = true
moveObject(drzwi, 2000,-2430.12, -653.64 , 135.05) --zamykanie drzwi
end
end
addEventHandler("onPlayerJoin", root, function()
for k,v in ipairs(getElementsByType("player")) do --to tworzy bind gdy wchodzimy w marker i mozemy otworzyc drzwi
function Creation(el, md)
bindKey(v, "e", "down", OtwieranieZamykanie)
end
addEventHandler("onMarkerHit", marker1, Creation)
addEventHandler("onMarkerHit", marker2, Creation)
function Delete(el, md)
unbindKey(v, "e", "down", OtwieranieZamykanie) --unbindKey gdy wyjdziemy z markeru zeby nie bylo ze 15 km otwierasz drzwi czy tym podobne
end
addEventHandler("onMarkerLeave", marker1, Delete)
addEventHandler("onMarkerLeave", marker2, Delete)
end
end)
[/lua]
mam problem poniewa? chcialmyb zrobic taka brame ,, i ter...
Witam!
Mog?aby mi jaka? osoba pom?c przy bramach? Ot?? chcia?bym zrobi? bram?, kt?r? m?g?by tylko otwiera?, Pracownik tuner-sf Pr?bowa?em to zrobi? lecz nie potrafi?. Stawiam zimne oraz za pomoc! Prosz? o jak najszybsz? pomoc!
Siemka
Ot?? mia?em problem z bram? i Ciastu? mi pom?g? i my?la?em ?e ju? jest dobrze
Lecz dzisiaj gdy moj kumpel pojecha? pod t? brame to te? sie otworzy?a a tylko moje uid by?o podane
Link do tamtego tematu: http://www.gtao.pl/brama-vt119208.htm
Siemka mam skrypt na bramy kt?re otwieraj? si? graczowi z danym UID.
Lecz gdy chce aby brama si? dla mnie otworzy?a to niestety nie dzia?a to. A w DB3 te? czystko a tak?e UID te? dobre poda?em.
Daje kod:
Witam posiadam bardzo dziwny problem a mianowicie. Gdy otwieram bram? podchodz?c ona si? otwiera lecz si? nie zamyka. Jak podejd? i szybko odejd? do bramy znowu to ona si? zamknie lecz po chwili si? otworzy
Witam zrobi?em sobie brame otwieraj?c? si? na cmd ale chcia?bym aby po np 4 sekundach sama sie zamyka?a niestety nie mam pomys?u jak to wykona? timerem czy jak.