Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-03-05, 02:46


Ciasteczkovvy







Wiek: 30
Na forum: 3744 dni
Posty: 17
Nick w MP: Ciasteczkowy

Piwa: 32

Respekt: 50

Ostrzeżeń: 100%
Po stronie servera kod:

Kod:

--[[
Lakiernia w danych miejscach.

@package GO-Life.pl
@copyright 2014 Split Wszystkie prawa zastrzezone
@author Split <splitgolife@o2.pl>

Nie masz prawa uzywac tego kodu bez naszej zgody.
Napisz do kogo? z nas, by? mo?e si? zgodzimy na u?ycie kodu.
Same kopiowanie kodu nie nauczy ci? pisa? samemu, wi?c lepiej nie kopiuj ?eby nie mie? problem?w.
]]--

local strefyLakiernicze = {
LakierniaDoherty = {
cuboid = {-100.25, 1177.78, 18.74, 10.00, 9.00, 5.00},-- cuboid w ktorym musi znalezc sie pojazd
marker = {-88.25, 1177.78, 18.74}, -- pozycja markera w ktorym gracz bedzie stal aby w??czy? lakierni?
dostep_frakcja = 1, -- id frakcji ktora ma do tego dostep
},
}

for i,v in pairs(strefyLakiernicze) do
setGarageOpen(21, true)
l_cuboid = createColCuboid(unpack(v.cuboid))
l_wybor = createMarker(v.marker[1], v.marker[2], v.marker[3], "cylinder", 1, 0, 0, 0, 100)
setElementData(l_wybor, "dostep_frakcja", v.dostep_frakcja)
setElementData(l_wybor, "lakiernia_cs", l_cuboid)
end

addEventHandler("onMarkerHit", root, function(el, md)
if getElementData(source, "lakiernia_cs") then
local accName = getAccountName (getPlayerAccount(el))
if isObjectInACLGroup("user."..accName, aclGetGroup("Mechanik")) then
if getElementType(el) == "player" then
local pojazd = getElementsWithinColShape(l_cuboid, "vehicle")
if #pojazd<1 then
outputChatBox("Na stanowisku lakierniczym nie ma ?adnego pojazdu!", el)
return
end
if #pojazd>1 then
outputChatBox("Na stanowisku lakierniczym jest zbyt du?o pojazd?w!", el)
return
end
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
if getVehicleOccupant(v) then
triggerClientEvent(el, "onWyborLakieru", root)
else
outputChatBox("Nikogo nie ma w poje?dzie wi?c lakierowanie jest niedost?pne!", el)
end
end
end
end
else
outputChatBox("Nie jeste? zatrudniony jako Mechanik Doherty San Fierro, mo?esz z?o?y? podanie na forum!", el, 255, 0, 0)
end
end
end)

addEvent("onLakierujPojazd", true)
addEventHandler("onLakierujPojazd", root, function(kolor)
if kolor == 0 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
playSoundFrontEnd(v, 46)
setTimer(setVehicleColor, 3000, 1, v, 255, 0, 0)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 1 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 255, 255, 0)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 2 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 0, 39, 194)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 3 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 0, 0, 0)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 4 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 255, 255, 255)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 5 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 128, 128, 128)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 6 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 150, 75, 0)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 7 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 225, 165, 0)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 8 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 65, 105, 225)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 9 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 255, 204, 221)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
if kolor == 10 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(v, l_cuboid) then
setGarageOpen(21, false)
setTimer(setVehicleColor, 3000, 1, v, 0, 255, 0)
setTimer(setGarageOpen, 4000, 1, 21, true)
end
end
end
end)


Pomo?e kto? zrobi? tak, aby dzia?a?o nie na id frakcji, ale na id skina mechanika, czyli 50.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-02, 12:57


limitowanyy







Wiek: 43
Na forum: 4556 dni
Posty: 41

Piwa: 281

Respekt: 20,5

Ostrzeżeń: 20%
--[[
Lakiernia w danych miejscach.

@package GO-Life.pl
@copyright 2014 Split Wszystkie prawa zastrzezone
@author Split <splitgolife@o2.pl>

Nie masz prawa uzywac tego kodu bez naszej zgody.
Napisz do kogoz nasbymo?e sizgodzimy na u?ycie kodu.
Same kopiowanie kodu nie nauczy cipisasamemuwi?c lepiej nie kopiuj ?eby nie mieproblem?w.
]]--

local strefyLakiernicze = {
LakierniaDoherty = {
cuboid = {-100.251177.7818.7410.009.005.00},-- cuboid w ktorym musi znalezc sie pojazd
marker = {-88.251177.7818.74}, -- pozycja markera w ktorym gracz bedzie stal aby w??czylakierni?
dostep_frakcja 1, -- id frakcji ktora ma do tego dostep
},
}

for i,v in pairs(strefyLakiernicze) do
setGarageOpen(21true)
l_cuboid createColCuboid(unpack(v.cuboid))
l_wybor createMarker(v.marker[1], v.marker[2], v.marker[3], "cylinder"1000100)
setElementData(l_wybor"dostep_frakcja"v.dostep_frakcja)
setElementData(l_wybor"lakiernia_cs"l_cuboid)
end

addEventHandler("onMarkerHit"root, function(elmd)
if getElementData(source"lakiernia_cs"then
local accName getAccountName (getPlayerAccount(el))
if isObjectInACLGroup("user."..accNameaclGetGroup("Mechanik")) then
if getElementType(el) == "player" then
local pojazd getElementsWithinColShape(l_cuboid"vehicle")
if #pojazd<1 then
outputChatBox("Na stanowisku lakierniczym nie ma ?adnego pojazdu!"el)
return
end
if #pojazd>1 then
outputChatBox("Na stanowisku lakierniczym jest zbyt du?o pojazd?w!"el)
return
end
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
if getVehicleOccupant(vthen
triggerClientEvent(el"onWyborLakieru"root)
else
outputChatBox("Nikogo nie ma w poje?dzie wi?c lakierowanie jest niedost?pne!"el)
end
end
end
end
else
outputChatBox("Nie jeste? zatrudniony jako Mechanik Doherty San Fierro, mo?esz z?o?y? podanie na forum!"el25500)
end
end
end)

addEvent("onLakierujPojazd"true)
addEventHandler("onLakierujPojazd"root, function(kolor)
if kolor == 0 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
playSoundFrontEnd(v46)
setTimer(setVehicleColor30001v25500)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 1 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v2552550)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 2 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v039194)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 3 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v000)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 4 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v255255255)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 5 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v128128128)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 6 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v150750)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 7 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v2251650)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 8 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v65105225)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 9 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v255204221)
setTimer(setGarageOpen4000121true)
end
end
end
if kolor == 10 then
for _,v in ipairs(getElementsByType("vehicle")) do
if isElementWithinColShape(vl_cuboidthen
setGarageOpen(21false)
setTimer(setVehicleColor30001v02550)
setTimer(setGarageOpen4000121true)
end
end
end
end)


W tym dziale obowi?zuje zakaz u?ywania znacznik?w [hide] //Emm


Ostatnio zmieniony przez Emm 2016-05-02, 12:58, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-02, 21:41


MIKAELmta







Wiek: 24
Na forum: 3979 dni
Posty: 311

Piwa: 10617

Respekt: 355,3
Respekt: 355,3Respekt: 355,3Respekt: 355,3Respekt: 355,3


skin == 50
if getElementModel == skin then

i tak do kazdej funkcji z warunkiem.

Postaw piwo autorowi tego posta
 

 
Tagi: lakiernia
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Lakiernia Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku