[ Dodano: 2018-09-01, 16:30 ]
Aha i jeszcze je?li nadal nie dzia?a to zmie? to:
--]]?Autor?skryptu:?Patrix
--W?bindach?pomaga?:?Atex
--W?animacji?pomaga?:?Emm
--Zakaz?zmiany?autora![[--
Aby zadzia?a?o musisz dodatkowo zrobi? reconnect, aby Ci si? ustawi?y bindy.
Polecam dorzuci? to:
addEventHandler("onResourceStart",root,function()
for k,v in ipairs(getElementsByType("player")) do
bindKey(v, "mouse_wheel_down","both","756djgndng5r54gt7875t54t65bgy45g")
bindKey(v, "mouse_wheel_up","both","t5gnu4gu54ygvb54vgv45g76y45g6745")
end
end)
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
--[[
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,animacja,true,false,false)
end
end
end
addCommandHandler("756djgndng5r54gt7875t54t65bgy45g", od ) -- haslo otwartych drzwi
addCommandHandler("t5gnu4gu54ygvb54vgv45g76y45g6745", zd ) -- haslo zamknietych drzwi
addEventHandler("onResourceStart",root,function()
for k,v in ipairs(getElementsByType("player")) do
bindKey(v, "mouse_wheel_down","both","756djgndng5r54gt7875t54t65bgy45g")
bindKey(v, "mouse_wheel_up","both","t5gnu4gu54ygvb54vgv45g76y45g6745")
end
end)
Marker by? zbyt nisko i nie wykrywa? gracza, kt?ry w niego wchodzi?.
Od siebie dorzuci?em bindowanie klawisza po wej?ciu i odbindowywanie po wyj?ciu z markera.
Gotowy kod:
--[[
Autor skryptu: Patrix
W bindach pomaga?: Atex
W animacji pomaga?: Emm
Zakaz zmiany autora!
]]--
bm = createMarker(-2305.70557, -157.99330, 34.36875, "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,animacja,true,false,false)
end
end
end
addCommandHandler("756djgndng5r54gt7875t54t65bgy45g", od ) -- haslo otwartych drzwi
addCommandHandler("t5gnu4gu54ygvb54vgv45g76y45g6745", zd ) -- haslo zamknietych drzwi
addEventHandler("onMarkerHit", bm, function(el, md)
if not md then return end
bindKey(el, "mouse_wheel_down", "down", "756djgndng5r54gt7875t54t65bgy45g")
bindKey(el, "mouse_wheel_up", "down", "t5gnu4gu54ygvb54vgv45g76y45g6745")
end)
addEventHandler("onMarkerLeave", bm, function(el, md)
if not md then return end
unbindKey(el, "mouse_wheel_down", "down", "756djgndng5r54gt7875t54t65bgy45g")
unbindKey(el, "mouse_wheel_up", "down", "t5gnu4gu54ygvb54vgv45g76y45g6745")
end)
PS. Je?li chcesz unikn?? zb?dnych komend (no chyba, ?e ich u?ywasz w innym skrypcie jeszcze) - mo?esz u?y? kodu poni?ej i b?dzie mia? on takie samo dzia?anie jak kod powy?ej:
--[[
Autor skryptu: Patrix
W bindach pomaga?: Atex
W animacji pomaga?: Emm
Zakaz zmiany autora!
]]--
local bm = createMarker(-2305.70557, -157.99330, 34.36875, "cylinder", 1.0, 0, 0, 0, 255)
local d = createObject (5856, -2306.5, -155.39, 36.40, 0, 0, 0)
function od(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d, 10000, -2306.5, -155.39, 32.20)
setPedAnimation(thePlayer, "CRIB", "CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
function zd(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d, 10000,-2306.5, -155.39, 36.40)
setPedAnimation(thePlayer, "CRIB","CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
addEventHandler("onMarkerHit", bm, function(el, md)
if not md then return end
bindKey(el, "mouse_wheel_down", "down", od)
bindKey(el, "mouse_wheel_up", "down", zd)
end)
addEventHandler("onMarkerLeave", bm, function(el, md)
if not md then return end
unbindKey(el, "mouse_wheel_down", "down", od)
unbindKey(el, "mouse_wheel_up", "down", zd)
end)
--[[
Autor skryptu: Patrix
W bindach pomaga?: Atex
W animacji pomaga?: Emm
Zakaz zmiany autora!
]]--
local bm = createMarker(-2305.70557, -157.99330, 34.5, "cylinder", 1.0, 0, 0, 0, 255)
local d = createObject (5856, -2306.5, -155.39, 36.40, 0, 0, 0)
function od(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d, 10000, -2306.5, -155.39, 32.20)
setPedAnimation(thePlayer, "CRIB", "CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
function zd(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d, 10000,-2306.5, -155.39, 36.40)
setPedAnimation(thePlayer, "CRIB","CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
addEventHandler("onMarkerHit", bm, function(el, md)
if not md then return end
bindKey(el, "mouse_wheel_down", "down", od)
bindKey(el, "mouse_wheel_up", "down", zd)
end)
addEventHandler("onMarkerLeave", bm, function(el, md)
if not md then return end
unbindKey(el, "mouse_wheel_down", "down", od)
unbindKey(el, "mouse_wheel_up", "down", zd)
end)
Najprawdopodobniej zmienne z bramy pierwszej oraz bramy drugiej koliduj? ze sob?.
Tworz?c drug? bram? mo?na u?y? zmiennej z poprzedniej bramy z dopiskiem '2' lub wykorzysta? nast?puj?ce tabele:
local bramy = {}
bramy[1] = *kod*
bramy[2] = *kod*
local markerybram = {}
markerybram[1] = *kod*
markerybram[2] = *kod*
oraz odpowiednio zrobiony skrypt na zmienne bram i marker?w.
Przyk?adowy kod pierwszego sposobu:
--[[
Autor skryptu: Patrix
W bindach pomaga?: Atex
W animacji pomaga?: Emm
Zakaz zmiany autora!
]]--
-- BRAMA PIERWSZA
local bm = createMarker(-2305.70557, -157.99330, 34.5, "cylinder", 1.0, 0, 0, 0, 255)
local d = createObject (5856, -2306.5, -155.39, 36.40, 0, 0, 0)
function od(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d, 10000, -2306.5, -155.39, 32.20)
setPedAnimation(thePlayer, "CRIB", "CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
function zd(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d, 10000,-2306.5, -155.39, 36.40)
setPedAnimation(thePlayer, "CRIB","CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
addEventHandler("onMarkerHit", bm, function(el, md)
if not md then return end
bindKey(el, "mouse_wheel_down", "down", od)
bindKey(el, "mouse_wheel_up", "down", zd)
end)
addEventHandler("onMarkerLeave", bm, function(el, md)
if not md then return end
unbindKey(el, "mouse_wheel_down", "down", od)
unbindKey(el, "mouse_wheel_up", "down", zd)
end)
-- BRAMA DRUGA
local bm2 = createMarker(x, y, z, "cylinder", 1.0, 0, 0, 0, 255)
local d2 = createObject (5856, x, y, z, 0, 0, 0)
function odbrama2(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm2) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d2, 10000, -2306.5, -155.39, 32.20)
setPedAnimation(thePlayer, "CRIB", "CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
function zdbrama2(thePlayer, key, state)
if isElementWithinMarker(thePlayer, bm2) then
if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("PSP")) then
moveObject(d2, 10000,-2306.5, -155.39, 36.40)
setPedAnimation(thePlayer, "CRIB","CRIB_Use_Switch", true, false, false)
setTimer(setPedAnimation, 1066.66, 1, thePlayer)
end
end
end
addEventHandler("onMarkerHit", bm2, function(el, md)
if not md then return end
bindKey(el, "mouse_wheel_down", "down", odbrama2)
bindKey(el, "mouse_wheel_up", "down", zdbrama2)
end)
addEventHandler("onMarkerLeave", bm2, function(el, md)
if not md then return end
unbindKey(el, "mouse_wheel_down", "down", odbrama2)
unbindKey(el, "mouse_wheel_up", "down", zdbrama2)
end)
W powy?szym kodzie zmie? oczywi?cie koordynaty markera oraz obiektu bramy drugiej. ; )
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