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

Wysłany: 2015-08-26, 20:56


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Siema. Mam kod na mechanika. I jak uzupe?ni? ten kod odpowiednimi rzeczami to jak wjad? uszkodzonym pojazdem na stanowisku i podejd? do markera to mam informacj? "Na stanowisku naprawczym nie ma ?adnego pojazdu!". Wie kto? o co chodzi? :-?

Dodam, ?e db3 milczy :(

--[[
@author Lukasz Biegaj <wielebny@bestplay.pl>
@author Karer <karer.programmer@gmail.com>
@author RacheT <rachet@pylife.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
@license Dual GPLv2/MIT
@package MTA-XyzzyRP
@link https://github.com/lpiob/MTA-XyzzyRP GitHub
]]--



-- uniwersalny kod wspoldzielony pomiedzy warsztatami

local strefyNapraw={

   --Doherty
  warsztatIdlewoodStanowsko11={
    cuboid={-2056.70176.3728.009.805.505.20 },-- cuboid w ktorym musi znalezc sie pojazd
    mpos={-2050.63175.9328.00}, -- pozycja markera w ktorym gracz bedzie stal aby naprawiac
    faction_id=3, -- id frakcji ktora ma do tego dostep
  },
  --Doherty
  warsztatIdlewoodStanowsko12={
    cuboid={-2056.72168.3028.009.805.505.20 },-- cuboid w ktorym musi znalezc sie pojazd
    mpos={-2050.12167.9628.00}, -- pozycja markera w ktorym gracz bedzie stal aby naprawiac
    faction_id=3, -- id frakcji ktora ma do tego dostep
  },
  --Garcia
  warsztatIdlewoodStanowsko13={
  cuboid={ -2331.62, -166.8534.510.00},-- cuboid w ktorym musi znalezc sie pojazd
  mpos={ -2329.33, -163.5034.5}, -- pozycja markera w ktorym gracz bedzie stal aby naprawiac
  faction_id=3, -- id frakcji ktora ma do tego dostep
  },
}

for i,v in pairs(strefyNapraw) do
  v.cs=createColCuboid(unpack(v.cuboid))
  css=createColCuboid( -2304.94, -124.9835.3210.0 )
  v.marker=createMarker(v.mpos[1], v.mpos[2], v.mpos[3], "cylinder"10,0,0,100)
  setElementData(v.marker,"cs",v.cs)
  setElementData(v.marker,"faction_id",v.faction_id)
  
end

--   triggerServerEvent("naprawaElementu"resourceRootnaprawiany_pojazdczesckoszt)
addEvent("naprawaElementu"true)
addEventHandler("naprawaElementu"resourceRoot, function(pojazdczesckoszt)
  outputDebugString("Naprawa elementu " .. czesc .. " za " .. koszt)
  takePlayerMoneyclientkoszt )
  if koszt>getPlayerMoney(clientthen
    return
  end

  if (czesc==-1then
--    setElementHealth(pojazd1000)

    local vps={}
    local vds={}
    local vls={}

    for i=0,do          vps[i]=getVehiclePanelState(pojazd,i)     end
    for i=0,do          vds[i]=getVehicleDoorState(pojazd,iend
    for i=0,do          vls[i]=getVehicleLightState(pojazd,iend

    fixVehicle(pojazd)

    for i=0,do      setVehiclePanelState(pojazdivps[i])    end
    for i=0,do      setVehicleDoorState(pojazdivds[i])    end
    for i=0,do      setVehicleLightState(pojazdivls[i])    end

    triggerClientEvent(client"refreshVehicleData"resourceRootpojazd)
  elseif czesc>=and czesc<=6 then
    setVehiclePanelState(pojazdczesc0)
    triggerClientEvent(client"refreshVehicleData"resourceRootpojazd)
  elseif czesc>=10 and czesc<20 then
    local drzwi=czesc-10
    setVehicleDoorState(pojazddrzwi0)
    triggerClientEvent(client"refreshVehicleData"resourceRootpojazd)
  elseif czesc>=20 then
    local swiatlo=czesc-20
    setVehicleLightState(pojazdswiatlo0)
    triggerClientEvent(client"refreshVehicleData"resourceRootpojazd)
  end
end)


--[[
@author Lukasz Biegaj <wielebny@bestplay.pl>
@author RacheT <rachet@pylife.pl>
@author karer <karer.programmer@gmail.com>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
@license Dual GPLv2/MIT
@package MTA-XyzzyRP
@link https://github.com/lpiob/MTA-XyzzyRP GitHub
]]--



local punkty_brania_kol={
 -- {-2042.60,162.87,28.84-0.9,1.5faction_id=3}, --idlewood

}

local warsztatyid = {
    [3]=true,
}

for i,v in ipairs(punkty_brania_kol) do
  v.marker=createMarker(v[1],v[2],v[3],"cylinder"v[4], 0,0,0,100)
  setElementData(v.marker"braniekola"true)
  setElementData(v.marker"faction:id"v.faction_id)
end


local function czyPracownikWarsztatu(gracz)
  local lfid=getElementData(gracz,"faction:id") or -1
  if not warsztatyid[lfidthen return false end
  return true
end

local function najblizszeKolo(gracz,pojazd)
  -- easy peasy
  local xg,yg,zg=getElementPosition(gracz)
  local najblizszeKolo=nil
  local najblizszeDist=1000

  local x,y,z=getElementPosition(pojazd)
  local _,_,rz=getElementRotation(pojazd)

  for i=1,do
    local rrz=math.rad(rz+45+(i-1)*90)
    local x+ (math.sin(-rrz))
    local y+ (math.cos(-rrz))
    if not najblizszeKolo or getDistanceBetweenPoints2D(x,y,xg,yg)<najblizszeDist then
      najblizszeDist=getDistanceBetweenPoints2D(x,y,xg,yg)
      najblizszeKolo=i
    end
  end
  -- ugly
  if not najblizszeKolo then return nil end
  if najblizszeKolo==4 then return 3
  elseif najblizszeKolo==3 then return 4 end
  return najblizszeKolo
end

local function zalozKolo(plr)

  local x,y,z=getElementPosition(plr)
  local _,_,rz=getElementRotation(plr)

  local rrz=math.rad(rz)
  local x+ (1.5 math.sin(-rrz))
  local y+ (1.5 math.cos(-rrz))

  local cs=createColSphere(x,y,z,2.5)
  local pojazdy=getElementsWithinColShape(cs,"vehicle")
  destroyElement(cs)
  if (#pojazdy~=1) then
    return false
  end

  -- okreslamykolo ktorego kola jest gracz

  local k1,k2,k3,k4=getVehicleWheelStates(pojazdy[1])
  if (k1==0) and (k2==0) and (k3==0) and (k4==0then return end
  local kolo=najblizszeKolo(plr,pojazdy[1])
  if not kolo then return end

  setPedAnimation(plr"MISC""pickup_box"1falsefalsetruetrue)
  toggleControl(plr"forward"false)
  setTimer(setPedAnimationProgress6001plr"pickup_box"0.5)
  setElementData(plr"blockSettingAnimation"true) --blokujemy ENTER
  if kolo==1 then
    k1=0
  elseif kolo==2 then
    k2=0
  elseif kolo==3 then
    k3=0
  elseif kolo==4 then
    k4=0
  end
  
  setTimer(setPedAnimation90001plr"ped""phone_in")
  setTimer(setPedAnimation93001plr)
  setTimer(setVehicleWheelStates90001pojazdy[1], k1k2k3k4)
  setTimer(setElementData90001plr"blockSettingAnimation"true)
  setTimer(toggleControl90001plr"forward"true)
  zabierzKolo(plr,9000)
end

function zabierzKolo(el,delay)
  local niesionyObiekt=getElementData(el,"niesioneKolo")
  if niesionyObiekt then
    
    if isElement(niesionyObiektthen
      if delay then
        setTimer(destroyElementdelay1niesionyObiekt)
      else
        destroyElement(niesionyObiekt)
      end
    end

    removeElementData(el,"niesioneKolo")
    setPedWalkingStyle(el,0)
    unbindKey(el"fire""down"zalozKolo)
    return true
  end
  return false
end



addEventHandler("onMarkerHit"resourceRoot, function(el,md)
  if not md or getElementType(el)~="player" then return end
  if not czyPracownikWarsztatu(elthen return end
  if not getElementData(source"braniekola"then return end
  if getElementData(source"faction:id") ~= getElementData(el"faction:id"then return end

  if zabierzKolo(elthen return end

  local kolo=createObject(1098,0,0,0)
  setObjectScale(kolo0.7)
  setElementData(el,"niesioneKolo"kolo,false)
--  attachElements(koloel0,0.4,-0.2,0,0,90)
  bindKey(el"fire""down"zalozKolo)
  exports["bone_attach"]:attachElementToBone(koloel110.1,-0.1,0)
  setPedWalkingStyle(el,66)
end)

pickup createPickup ( -2041.72986,158.42293,28.83594,312750setElementDimension (pickup0)

addEventHandler "onPickupHit"pickup, function(element)
    if isObjectInACLGroup ("user."..getAccountName getPlayerAccount element ) ), aclGetGroup "Mechanik" ) ) then
            cywilt getTeamFromName "CYWILE" )
            setPlayerTeam elementcywilt )
        if getAccountData getPlayerAccount element ), "stary:skin" then
            id tonumber getAccountData getPlayerAccount element ), "stary:skin" ) )
            setElementModel elementid ) 
            setAccountData getPlayerAccount element ), "stary:skin"false )
        else
            skin tonumber getElementModel element ) )
            setAccountData getPlayerAccount element ), "stary:skin"skin )
            setElementModel element50  )
end
    end
    end)--POGO!!!
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    --[[    
    
    myMarker3 createMarker( -2039.64,174.76,28.84-0.9'cylinder'1000)
    bra3 createObject 11416, -2038.88,178.76,29.8400)
function MarkerHit3  (hitPlayermatchingDimension)
local playera hitPlayer
local easing "OutBounce"
local time 5000
if getElementTypeplayera ) == "player" then
if isObjectInACLGroup'user.'..getAccountNamegetPlayerAccountplayera ) ), aclGetGroup"Mechanik" ) )  then  
moveObject bra3time, -2038.88,178.76,29.84-5.5000easing)
end
    end
        end


function MarkerLeave3 ()
local easing2 "OutBounce"
local time 5000
moveObject bra3time, -2038.88,178.76,29.84000easing2)
end
addEventHandler "onMarkerHit"myMarker3MarkerHit3 )
addEventHandler "onMarkerLeave"myMarker3MarkerLeave3 )
--]]










local pojazdyPubliczne = {
    {525, -2053.08,146.19,28.71,358.1,0.0,179.4},
    {525, -2047.16,146.22,28.72,358.2,360.0,180.0},    
}

for i,v in ipairs(pojazdyPubliczne) do
    local pojazd createVehicle(v[1], v[2], v[3], v[4], v[5], v[6], v[7])
    setElementData(pojazd"pojazd_opis""Mech #"..i.."")
    setElementFrozen(pojazdtrue)
    setElementData(pojazd"pojazd_paliwo"100)
end


addEventHandler("onVehicleStartEnter"resourceRoot, function(plr,seat)
if seat == 0 then
local accountName=getAccountName(getPlayerAccount(plr))
if isObjectInACLGroup("user."..accountNameaclGetGroup("Mechanik")) then return end
outputChatBox("* Nie jeste? pracownikiem."plr25500)
cancelEvent()
return
end
end)

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
        setElementData(source"pojazd_paliwo"100)
    end
end)
    


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:07


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Zle podales cuboid ;0

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:14


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"AstroStudio" napisał/a:

Zle podales cuboid ;0


A jak poda? ?? Bo mam skrypt na /gp co pokazuje pozycj? i rotacj? elementu i po prostu to wklei?em :D

[ Dodano: 2015-08-26, 21:15 ]
Dobra, ju? na wiki widz? xD.

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:16


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

to zle musisz pobrac skrypt editcol :) http://community.multithe...details&id=3804

i wpisujesz potem /editcol i sie bawisz :)

PS : POMOG?EM ? DAJ PIFFKO :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:16


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Masz skrypt tzw. "runcode"? Jezeli nie to go pobierz z community i uruchom na serwie. Po uruchomieniu otworz konsole (F8) i wpisz:


srun setDevelopmentMode(true)

Jezeli wpisales to i sie wyswietlil rozowy tekst na czacie to teraz wpisz komende /showcol 1 i widzisz cuboidy.


@Down literowa... Wybacz

Ostatnio zmieniony przez Fanciak 2015-08-26, 21:20, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:19


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
"Fanciak" napisał/a:


srun setDevelopmentMode(true)


Je?eli masz ?le pomaga?, lepiej si? nie udzielaj... Ta funkcja jest po stronie Client'a, czyli crun...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:20


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"AstroStudio" napisał/a:

PS : POMOG?EM ? DAJ PIFFKO :)


Ta, dam jak zadzia?a :) . Ale tera jest b??d:

Kod:

[2015-08-26 21:18] WARNING: mechLS\naprawa_ls_s.lua:39: Bad argument @ 'createColCuboid' [Expected number at argument 5, got none]
[2015-08-26 21:18] WARNING: mechLS\naprawa_ls_s.lua:39: Bad argument @ 'createColCuboid' [Expected number at argument 5, got none]
[2015-08-26 21:18] WARNING: mechLS\naprawa_ls_s.lua:39: Bad argument @ 'createColCuboid' [Expected number at argument 5, got none]


A ta linijka to:

  css=createColCuboid( -2304.94, -124.9835.3210.0 )


[ Dodano: 2015-08-26, 21:21 ]
Z ?adnymi skryptami nie chce mi sie bawi? :) . Nie licz?c mechanika lol

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:24


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

jg2aviva1,


  css=createColCuboid( -2304.94, -124.9835.32105)


Pokombinuj z trzema ostatnimi argumentami - popatrz jak to widac na /showcol 1

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:25


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"DestroY" napisał/a:

Urwa?e? 2 argumenty, a 3 przypuszczam, ?e te? jest ?le...

Cytat:


fX: The X position of the collision cuboid's western side
fY: The Y position of the collision cuboid's southern side
fZ: The Z position of the collision cuboid's lowest side
fWidth: The collision cuboid's width
fDepth: The collision cuboid's depth
fHeight: The collision cuboid's height


Ale .. ehh..

Ja to skopiowa?em z innego skryptu kt?ry dzia?a?, podmieni?em argumenty i odpali?em. I nie dzia?a ;( . Na co mi poprawa tego skoro ju? i tak to "fabrycznie" by?o??

[ Komentarz dodany przez: DestroY: 2015-08-26, 21:27 ]
Mo?e i to tak by?o fabrycznie, ale nie by?o to dobrze...

[ Dodano: 2015-08-26, 21:33 ]
AstroStudio, tego twojego skryptu w og?le nie ogarnian :-?

Fanciak, dalej nie dzia?a. A tego skryptu "runcode" wgl nie wyszukuje na community ;(

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:38


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Runcode powinien juz by? wgrany automatycznie. Zobacz, czy nie ma /start runcode

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:49


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

coleditor jest banalny ;) jezeli ogarniesz to klikasz enter/spacje nie pamietam i potem masz kordy i wysokosc,szerokosc,dlugosc i to kopiujesz itd ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:51


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Fanciak, jeste? bogiem xD. Temat do zamkni?cia je?li powiecie, co jeszcze daje ten runcode :)

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:53


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

jg2aviva1, on daje du?o mo?liwo?ci xD

Oto link : http://www.gtaonline.pl/p...ode-vt60796.htm

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 21:57


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4134 dni
Posty: 445
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1033

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"BlackGamePL" napisał/a:

jg2aviva1, on daje du?o mo?liwo?ci xD

Oto link : http://www.gtaonline.pl/p...ode-vt60796.htm


Bo ja wiem czy du?o.. Tam nawet nie jest opisane w?a?nie to /showcol 1 np. A mi chodzi wlasnie o cos takiego, co by mi skrypting u?atwi?o :)

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-26, 22:03


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

W runcode u?ywasz funkcji z mta.

NP. createVehice, createPed itd.

srun - strona serwera

crun - strona clienta

Postaw piwo autorowi tego posta
 

 
Tagi: mechanik
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Mechanik 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