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

Wysłany: 2020-05-24, 15:00


HEATEX







Wiek: 25
Na forum: 2251 dni
Posty: 109
Nick w MP: HEATEX

Piwa: 1336

Respekt: 50

Ostrzeżeń: 20%
c_license.lua

--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

mojeW,mojeH 12801024
sW,sH guiGetScreenSize()
w= (sW/mojeW), (sH/mojeH)

local sxsy guiGetScreenSize ()
 
prawko false 

function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

local marker=createMarker(-2033.08, -117.491035.17-1"cylinder"1.2012225555) -- Prawo Jazdy
setElementInterior(marker3)
setElementDimension(marker1)
setElementData(marker'typ''pojazd')

local marker2=createMarker(-2237.232353.974.98-1"cylinder"1.2012225555) -- Licencja Lotnicza
setElementInterior(marker20)

local t=createElement("text")
setElementInterior(t3)
setElementDimension(t1)
setElementPosition(t,-2033.08, -117.491035.17)
setElementData(t,"name","Zdawanie na prawo jazdy")

local t2=createElement("text")
setElementInterior(t20)
setElementPosition(t2, -2237.232353.974.98)
setElementData(t2,"name","Zdawanie licencji lotniczej")


local wm={}
--[[wm.gridlist=guiCreateWindow(0.210.200.570.54"Zdawanie prawa jazdy"true)
guiWindowSetSizable(wm.gridlistfalse)
guiWindowSetMovable(wm.gridlistfalse)
guiSetVisible(wm.gridlistfalse)
wm.label=guiCreateLabel(0.020.060.960.05"Z poni?szej listy wybierz kategori? prawa jazdy do kt?rej chcesz przyst?pi? p??niej kliknij Przyst?p"truewm.gridlist)
guiLabelSetHorizontalAlign(wm.label"center"false)
guiLabelSetVerticalAlign(wm.label"center")--]]
wm.gridlist=guiCreateGridList(357*w393*h567*w218*hfalse)
guiGridListAddColumn(wm.gridlist"Kategoria"0.24)
guiGridListAddColumn(wm.gridlist"Pojazdy"0.24)
guiGridListAddColumn(wm.gridlist"Koszt"0.24)
guiGridListAddColumn(wm.gridlist"Zaliczone"0.24)
guiSetVisible(wm.gridlistfalse)
guiSetAlpha(wm.gridlist0.8)
guiSetFont(wm.gridlist"default-bold-small")
--wm.close=guiCreateButton(0.620.830.360.13"Zamknij"true)
--wm.submit=guiCreateButton(0.020.830.360.13"Przyst?p"true)

local function fillLicenseData()
    guiGridListClear(wm.gridlist)
    for i,v in ipairs(licenseCategory) do
        local row=guiGridListAddRow(wm.gridlist)
        guiGridListSetItemText(wm.gridlistrow1v[1], falsefalse)
        guiGridListSetItemText(wm.gridlistrow2v[2], falsefalse)
        guiGridListSetItemText(wm.gridlistrow3v[3].." PLN"falsefalse)
        guiGridListSetItemData(wm.gridlistrow3v[3])
        -- Settings
        if getElementData(localPlayer,"player:license:pj"..v[1]) == 1 then
            guiGridListSetItemText(wm.gridlistrow4"TAK"falsefalse)
            guiGridListSetItemColor(wm.gridlistrow402550)
        else
            guiGridListSetItemText(wm.gridlistrow4"NIE"falsefalse)
            guiGridListSetItemColor(wm.gridlistrow425500)
        end
    end
end

local function fillLicenseData2()
    guiGridListClear(wm.gridlist)
    for i,v in ipairs(licenseCategory2) do
        local row=guiGridListAddRow(wm.gridlist)
        guiGridListSetItemText(wm.gridlistrow1v[1], falsefalse)
        guiGridListSetItemText(wm.gridlistrow2v[2], falsefalse)
        guiGridListSetItemText(wm.gridlistrow3v[3].." PLN"falsefalse)
        guiGridListSetItemData(wm.gridlistrow3v[3])
        -- Settings
        if getElementData(localPlayer,"player:license:pj"..v[1]) == 1 then
            guiGridListSetItemText(wm.gridlistrow4"TAK"falsefalse)
            guiGridListSetItemColor(wm.gridlistrow402550)
        else
            guiGridListSetItemText(wm.gridlistrow4"NIE"falsefalse)
            guiGridListSetItemColor(wm.gridlistrow425500)
        end
    end
end

addEventHandler("onClientClick"root, function(btnstate)
    if btn == "left" and state == "down" then
    if prawko == true then
    if mysz(352*w624*h210*w78*hthen
    local selectedRow=guiGridListGetSelectedItem(wm.gridlist)
    if not selectedRow or selectedRow 0 then return end
    local cat=guiGridListGetItemText(wm.gridlistselectedRow1)
    local cost=guiGridListGetItemData(wm.gridlistselectedRow3)
    local zdane=guiGridListGetItemText(wm.gridlistselectedRow4)
    if tonumber(cost) > getPlayerMoney(localPlayerthen
        --outputChatBox("* Nie posiadasz tyle got?wki."25500)
        triggerEvent('onClientAddNotification'localPlayer'Nie posiadasz wystarczaj?co got?wki\ndo przyst?pienia egzaminu z prawa jazdy''error')
        return
    end
    --[[if getPlayerName(localPlayer) ~= "Split" then
        outputChatBox("* W budowie..."25500)
        return
    end]]
    if zdane ~= "TAK" then
        triggerServerEvent("license:do"resourceRoottonumber(cost), cat)
        if not guiGetVisible(wm.gridlistthen return end
        guiSetVisible(wm.gridlistfalse)
        showCursor(false)
    prawko false
        removeEventHandler("onClientRender",root,gui3)
    else
        --outputChatBox("* Posiadasz ju? zdane prawo jazdy."25500)
        triggerEvent('onClientAddNotification'localPlayer'Posiadasz prawo jazdy zaznaczonej kategorii.''error')
    end
    end
    end
    end
end)

addEventHandler("onClientClick"root, function(btnstate)
    if btn == "left" and state == "down" then
    if prawko == true then
    if mysz(718*w624*h210*w78*hthen
    if not guiGetVisible(wm.gridlistthen return end
    showCursor(false)
    guiSetVisible(wm.gridlistfalse)
    removeEventHandler("onClientRender",root,gui3)
    prawko false
    end
    end
    end
end)

addEventHandler("onClientMarkerHit"marker, function(el,md)
    if not md or el~=localPlayer then return end
    if guiGetVisible(wm.gridlistthen return end
    showCursor(true)
    guiSetVisible(wm.gridlist,true)
    if prawko == false then
    addEventHandler("onClientRender",root,gui3)
    prawko true
    fillLicenseData()
    end
end)

addEventHandler("onClientMarkerHit"marker2, function(el,md)
    if not md or el~=localPlayer then return end
    if guiGetVisible(wm.gridlistthen return end
    showCursor(true)
    guiSetVisible(wm.gridlist,true)
    if prawko == false then
    addEventHandler("onClientRender",root,gui3)
    prawko true
    fillLicenseData2()
    end
end)

function gui3()
        dxDrawImage(315*w313*h650*w400*h"img/prawojazdy-psrpg.png"000tocolor(255255255255), false)
end

c_zdawanie.lua

--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

local licenseBlip
local licenseTarget
local licenseMarker
local licenseVehicle
local licenseCategory

local categoryPositions={
    ["A"]={
        {2115.80, -1762.9013.40},
        {2135.09, -1752.2613.40},
        {2175.67, -1752.1713.38},
        {2184.91, -1740.5313.38},
        {2207.03, -1732.1913.41},
        {2215.90, -1768.8113.36},
        {2218.52, -1855.5713.36},
        {2218.59, -1894.0813.36},
        {2185.17, -1894.3913.47},
        {2092.06, -1894.4713.47},
        {2082.00, -1908.5013.47},
        {2056.64, -1932.5513.47},
        {1991.55, -1932.4613.47},
        {1929.69, -1932.3313.47},
        {1857.41, -1932.4713.47},
        {1821.68, -1916.3613.47},
        {1804.67, -1895.9213.47},
        {1804.05, -1930.6913.47},
    },
    ["C"]={
        {2072.98, -1915.3613.55},
        {2080.45, -1908.6013.36},
        {2078.39, -1819.7913.36},
        {2092.70, -1752.0213.36},
        {2112.70, -1677.5813.36},
        {2112.76, -1608.7024.23},
        {2112.74, -1527.8423.85},
        {2112.71, -1479.0423.85},
        {2083.44, -1463.2923.85},
        {2019.42, -1463.4513.60},
        {1938.50, -1463.5213.60},
        {1863.57, -1463.2513.60},
        {1849.31, -1481.4513.60},
        {1832.49, -1544.3613.60},
        {1821.70, -1661.6413.60},
        {1821.78, -1815.0213.60},
        {1821.83, -1864.7013.60},
        {1816.34, -1884.9313.60},
        {1789.48, -1908.2613.60},
        {1775.47, -1919.5013.39},
    },
    ["B"]={
        {1800.55, -1854.9913.41},
        {1820.21, -1833.0713.41},
        {1793.59, -1830.7713.41},
        {1701.16, -1811.6613.41},
        {1689.84, -1774.2613.41},
        {1689.66, -1736.1813.41},
        {1688.81, -1618.4713.38},
        {1690.25, -1593.7213.38},
        {1734.13, -1597.2413.38},
        {1776.04, -1607.5713.38},
        {1813.59, -1612.9213.38},
        {1821.72, -1652.3713.38},
        {1821.94, -1760.6513.38},
        {1820.98, -1808.6413.38},
        {1820.73, -1853.7113.38},
        {1818.94, -1889.8213.39},
        {1803.95, -1891.3113.39},
        {1777.80, -1891.2313.39},
         
    },
    ["L"]={
        {-2227.072287.3426.95},
        {-2269.482247.5335.66},
        {-2339.912199.1335.66},
        {-2472.092112.4335.66},
        {-2549.212064.1835.66},
        {-2672.072004.8435.66},
        {-2748.911935.9635.66},
        {-2681.771846.7142.90},
        {-2444.561937.2745.25},
        {-2341.071992.4545.25},
        {-2206.642108.5345.25},
        {-2227.782326.718.60},
    },
    ["T"]={
        {-2003.43,438.75,35.02},
        {-2003.63380.5135.50},
        {-2003.63348.3535.50},
        {-2003.76303.0635.29},
        {-2005.54250.2230.41},
        {-2006.50194.4428.00},
        {-2006.50128.6228.00},
        {-2006.5452.0331.28},
        {-2062.9930.3835.62},
        {-2136.5230.3935.62},
        {-2166.63, -15.6735.62},
        {-2188.21, -70.0035.62},
        {-2254.33, -61.1635.62},
        {-2254.5711.8535.62},
        {-2252.3888.1735.62},
        {-2251.50164.3635.62},
        {-2251.39242.8835.62},
        {-2251.43322.0635.62},
        {-2290.05400.8035.47},
        {-2357.34477.0631.12},
        {-2287.46508.6135.50},
        {-2264.88614.1144.05},
        {-2264.94748.6149.81},
        {-2264.88892.2166.91},
        {-2264.811013.7684.66},
        {-2264.471072.9781.14},
        {-2263.621095.9580.17},
    },
}

function finishLicense(value)
    if isElement(licenseMarker) and licenseMarker then
        destroyElement(licenseMarker)
        licenseMarker=nil
    end
    if isElement(licenseBlip) and licenseBlip then
        destroyElement(licenseBlip)
        licenseBlip=nil
    end
    if value == true then
        licenseCategory=nil
        licenseVehicle=nil
        licenseMarker=nil
        licenseTarget=nil
        licenseBlip=nil
    end
end
addEvent("license:finish",true)
addEventHandler("license:finish"resourceRootfinishLicense)

function showMarker()
    local pos=categoryPositions[licenseCategory][licenseTarget]
    if licenseCategory ~= "L" then
    licenseMarker=createMarker(pos[1], pos[2], pos[3], "checkpoint"200255155)
    else
    licenseMarker=createMarker(pos[1], pos[2], pos[3], "ring"3.500255155)
    end
    licenseBlip=createBlip(pos[1], pos[2], pos[3], 411.1502550)
    if categoryPositions[licenseCategory][licenseTarget+1then
          e=categoryPositions[licenseCategory][licenseTarget+1]
        setMarkerTarget(licenseMarkere[1], e[2], e[3])
    end
    addEventHandler("onClientMarkerHit"licenseMarker, function(el,md)
        if not md or el~=localPlayer then return end
        if not getPedOccupiedVehicle(elthen return end
        if licenseTarget #categoryPositions[licenseCategory] then
            --local sound=playSound(":ogrpg-misc/misc/point.wav")
            --setSoundVolume(sound1.0)
            
            finishLicense(false)
            licenseTarget=licenseTarget+1
            showMarker()
        else
            --local sound=playSound(":ogrpg-misc/misc/success.flac")
            --setSoundVolume(sound1.0)

            --outputChatBox("* Zda?e?(a?) egzamin. Gratulacje!")
            triggerEvent('onClientAddNotification'localPlayer'Pomy?lnie zda?e? egzamin z prawa jazdy.\nGratulacje!''success')
            triggerServerEvent("license:vehdel"resourceRootlicenseVehicle)
            setElementData(localPlayer,"player:license:pj"..licenseCategory1)
            finishLicense(true)
            fadeCamera(kierowca,false,1)
            setTimer(fadeCamera,1000,1,kierowca,true,1)
            setTimer(setElementPosition,1001,1,kierowca,1749.11, -1860.7313.57)
        end
    end)
end

addEvent("license:start",true)
addEventHandler("license:start"resourceRoot, function(category,vehicle)
    licenseTarget=1
    licenseBlip=nil
    licenseMarker=nil
    licenseCategory=category
    licenseVehicle=vehicle
    showMarker()
end)

punkty={}

function nalicz()
    local veh=getPedOccupiedVehicle(localPlayer)
    if not veh then return end
    local x,y,z=getElementPosition(veh)
    table.insert(punkty, {x,y,z})
    outputChatBox("* Dodano")
end

addCommandHandler("zakoncz", function()
    for i,v in ipairs(punkty) do
        lol=string.format("{%.02f, %.02f, %.02f},"v[1], v[2], v[3])
        outputChatBox("        "..lol)
        killTimer(punkty_timer)
    end
end)

addCommandHandler("licz", function()
    outputChatBox("* Rozpocz??e?(a?) naliczanie, aby zako?czy? wpisz /zakoncz")
    punkty_timer=setTimer(nalicz30000)
end)--]]

s_zdawanie.lua

--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

--[[local marker2=createMarker(-2050.29,-106.16,35.24,"corona",2,170,200,0)

addEventHandler("onMarkerHit"marker2, function(el,md)
 setElementPosition(el,-2044.69,-94.57,35.17 )
end)--]]

--local zone createColCuboid(-157.625625610351108.405273437518.61372947692979.86.4)
createBlip(-2237.232353.974.985,2,0,0,0,0,0,275addEvent("license:do",true)
addEventHandler("license:do"resourceRoot, function(cost,selected)
    if tonumber(cost) <= getPlayerMoney(clientthen
        takePlayerMoney(client,cost)
    end

    local veh=nil
  licka_object = {}
      local elka createObject(323,0,0,0)
        setElementCollisionsEnabled(elkafalse)
    if selected == "A" then veh=createVehicle(4632116.76, -1783.5313.050.00.04.2)
    attachElements(elkaveh0,-1.25,0.10,140,0,180)
    elseif selected == "B" then veh=createVehicle(4581725.82, -1854.9313.29360.0360.0269.3)
    attachElements(elkaveh0,0.10,0.7,90,0,180)
    elseif selected == "C" then veh=createVehicle(4142052.25, -1913.6713.23360.00.0270.8)
    attachElements(elkaveh0,0.50,2.35,90,0,180)
    elseif selected == "L" then veh=createVehicle(469, -2227.612325.417.600.2359.8180.0end
    if not veh then return end
    if selected == "L" then
    setElementData(veh,"vehicle:desc","Egzamin Licencji Lotniczej\nKategoria "..selected)
    else
    setElementData(veh,"vehicle:desc","Egzamin prawa jazdy\nKategoria "..selected)
    end
    setElementData(veh,"vehicle:mileage",16442)
    setElementData(veh,"vehicle:fuel",100)
    setElementData(veh,"vehicle:lic",true)
    setElementDimension(client,0)
    setElementInterior(client,0)
    warpPedIntoVehicle(client,veh)
    triggerClientEvent(client"license:start"resourceRootselectedveh)
end)

addEvent("license:vehdel"true)
addEventHandler("license:vehdel"resourceRoot, function(veh)
    destroyElement(veh)
end)

addEventHandler("onPlayerQuit"root, function()
    local veh=getPedOccupiedVehicle(source)
    if not veh then return end
    if getVehicleController(veh) ~= source then return end
    if not getElementData(veh,"vehicle:lic"then return end
    destroyElement(veh)
end)

addEventHandler("onVehicleDamage"resourceRoot, function(loss)
    local kierowca=getVehicleController(source)
    local lot getElementModel(source)
    if not kierowca then return end
    if not getElementData(source,"vehicle:lic"then return end
    destroyElement(source)
    --outputChatBox("* Uszkodzi?e?(a?) pojazd, nie zdajesz egzaminu!"kierowca25500)
    triggerClientEvent(kierowca'onClientAddNotification'kierowca'Uszkodzi?e?/a? pojazd egzaminacyjny,\nnie zdajesz egzaminu.''error')
    triggerClientEvent(kierowca"license:finish"resourceRoottrue)
    fadeCamera(kierowca,false,1)
    setTimer(fadeCamera,1000,1,kierowca,true,1)
    if lot == 469 then
    setTimer(setElementPosition,1001,1,kierowca,-2240.702350.854.98)
    else
    setTimer(setElementPosition,1001,1,kierowca,1749.11, -1860.7313.57)
    end
end)

addEventHandler("onVehicleStartExit"resourceRoot, function()
    cancelEvent()
end)

--[[addCommandHandler("lotgp", function(plr,cmd)
    local x,y,z=getElementPosition(plr)
    local p=string.format("{%.02f, %.02f, %.02f},"x,y,z)
    outputChatBox(pplr)
end)

addCommandHandler("lotgp2", function(plr,cmd)
    local veh=getPedOccupiedVehicle(plr)
    if not veh then return end
    local x,y,z=getElementPosition(veh)
    local rx,ry,rz=getElementRotation(veh)
    local p=string.format("%.02f, %.02f, %.02f, %.02f, %.02f, %.02f"x,y,z,rx,ry,rz)
    outputChatBox(pplr)
end)--]]


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-05-24, 15:03


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

setElementCollidableWith


Postaw piwo autorowi tego posta
 

 
Tagi: wylaczenie :: kolizji :: pojazdow :: zdawajacych :: prawko
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Wylaczenie kolizji pojazdow zdawajacych prawko Odpowiedz do tematu

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