Wysłany: 2016-03-05, 02:46
Ciasteczkovvy
Wiek: 30 Na forum: 3744 dni Posty: 17
Nick w MP: Ciasteczkowy
Piwa : 32
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.
Wysłany: 2016-05-02, 12:57
limitowanyy
Wiek: 43 Na forum: 4556 dni Posty: 41
Piwa : 281
--[[
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 )
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
Wysłany: 2016-05-02, 21:41
MIKAELmta
Wiek: 24 Na forum: 3979 dni Posty: 311
Piwa : 10617
skin == 50
if getElementModel == skin then
i tak do kazdej funkcji z warunkiem.
Tagi: lakiernia
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: