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

Wysłany: 2016-05-06, 12:19


Odważny

Początki LUA :P






Wiek: 26
Na forum: 3880 dni
Posty: 140
Nick w MP: ReseT_

Piwa: 166

Respekt: 50

chce zeby wywalalo od razu z pojazdu po zabraniu prawka

ca?y kod:

local prawko = createMarker(1498.68, -1582.67, 13.55-1, "cylinder", 1.3, 255, 0, 45)
createBlip(1498, -1582, 13,36, 2, 255,0,0,255,0,600)

local punktyJazdy = {
    {-210.72,2752.92,62.14},
    {-255.60,2749.25,62.14},
    {-261.41,2704.73,62.14},
    {-373.17,2689.60,63.64},
    {-496.67,2717.22,65.17},
    {-669.99,2743.08,57.82},
    {-897.10,2725.68,45.47},
    {-1342.10,2644.28,50.06},
    {-1427.61,2722.17,62.32},
    {-1630.73,2724.74,57.3},
    {-1629.25,2671.54,54.0},
    {-1432.59,2668.04,55.2},
    {-1428.40,2600.62,55.29},
    {-1383.36,2595.85,55.35},
    {-1433.72,2470.19,60.6},
    {-1386.63,2244.65,54.39},
    {-1331.77,1985.98,51.44},
    {-1179.59,1797.23,40.13},
    {-1019.95,1726.44,30.63},
    {-859.87,1612.33,26.52},
    {-846.97,1417.25,13.21},
    {-727.69,1232.62,12.9},
    {-577.40,1113.11,10.53},
    {-397.64,1003.44,10.36},
    {-296.81,809.74,14.34},
    {0.25,879.92,22.23},
    {226.69,969.67,27.79},
    {188.18,1141.93,14.28},
    {311.04,1277.22,13.20},
    {410.16,1589.83,17.42},
    {534.97,1679.41,11.07},
    {523.52,1714.50,10.57},
    {595.62,1844.41,14.33},
    {614.83,2010.26,35.47},
    {594.04,2159.82,38.54},
    {548.14,2328.54,31.98},
    {401.01,2370.79,24.90},
    {180.76,2284.77,21.97},
    {66.80,2303.70,20.88},
    {-67.08,2339.74,20.39},
    {-109.90,2458.24,13.92},
    {-260.89,2518.30,32.36},
    {-418.80,2453.45,44.47},
    {-575.04,2425.80,66.73},
    {-698.66,2519.93,74.82},
    {-736.24,2649.28,63.51},
    {-776.59,2724.04,44.95},
    {-646.76,2744.49,60.32},
    {-516.95,2712.18,65.62},
    {-376.49,2684.56,64.10},
    {-259.19,2699.65,62.14},
    {-187.15,2699.91,62.14},
    {-186.09,2748.80,62.16},
    {-230.95,2753.00,62.14},
    {-233.51,2729.45,62.29},
}

function showNextCP(plr)
    local punkt = getElementData(plr, "egzaminP_postep")
    local ile = punktyJazdy[punkt]
    
    if not ile then
        egzaminKoniec(plr, true)
        return
    end
    
    local marker = createMarker(ile[1], ile[2], ile[3], "checkpoint", 5, 255, 0, 0, 200, plr)
    setElementData(plr, "egzaminP_marker", marker)
    
    if punktyJazdy[punkt+1] then
        ile = punktyJazdy[punkt+1]
        setMarkerTarget(marker, ile[1], ile[2], ile[3])
    end
end

addEventHandler("onMarkerHit", resourceRoot, function(el, md)
    if not isElement(el) or not md or getElementType(el) ~= "player" then return end
    
    if isElementWithinMarker(el, prawko) then
    if getElementData(el, "prawojazdy") == 1 then
            outputChatBox("Posiadasz ju? prawo jazdy.")
            return
        end
        egzaminStart(el)
        return
    end
    
    if not isElementVisibleTo(source, el) then return end
    
    local postep = getElementData(el, "egzaminP_postep")
    if not postep then return end
    
    if not punktyJazdy[postep] then return end
    
    destroyElement(source)
    playSoundFrontEnd(el, 12)
    
    postep = postep+1
    setElementData(el, "egzaminP_postep", postep)
    
    showNextCP(el)
    
end)

function egzaminStart(plr)
    setElementInterior(plr, 0)
    setElementDimension(plr, 0)
    
    local pojazd = createVehicle(589, -217.81,2731.32,62.29,0.0,360.0,89.6)
    setElementData(pojazd, "pojazd_przebieg", math.random(10000, 20000))
    setElementData(pojazd, "pojazd_paliwo", 100)
    setElementData(pojazd, "pojazd_opis", "Pojazd prawa jazdy")
    warpPedIntoVehicle(plr, pojazd)
    
    setElementData(plr, "egzaminP_postep", 1)
    setElementData(plr, "egzaminP_vehicle", pojazd)
    
    showNextCP(plr)
    return true
end

function egzaminKoniec(plr, udany)
    local pojazd = getElementData(plr, "egzaminP_vehicle")
    if not pojazd then return end
    
    destroyElement(pojazd)
    removePedFromVehicle(plr)
    removeElementData(plr, "egzaminP_marker")
    removeElementData(plr, "egzaminP_vehicle")
    
    if getElementData(plr, "egzaminP_marker") and isElement(getElementData(plr, "egzaminP_marker")) then
        destroyElement(getElementData(plr, "egzaminP_marker"))
    end
    
    setElementInterior(plr, 0)
    setElementDimension(plr, 0)
    setElementPosition(plr, 1505.72, -1583.88, 13.55)

    if udany then
    setAccountData(getPlayerAccount(plr), "prawojazdy", true)
        outputChatBox("* Gratulacje! Zda?e? egzamin prawa jazdy!", plr)
    end
end

addEventHandler("onVehicleDamage", resourceRoot, function(loss)
    local kierowca = getVehicleController(source)
    if not kierowca then return end
    
    local pojazd = getElementData(kierowca, "egzaminP_vehicle")
    if not pojazd or pojazd ~= source then return end
    
    if loss > 5 then
        egzaminKoniec(kierowca, false)
        outputChatBox("* Uszkodzi?e? pojazd! Koniec egzaminu!", kierowca, 255, 0, 0)
    end
end)

addEventHandler("onPlayerWasted", root, function()
    local pojazd = getElementData(source, "egzaminP_vehicle")
    if not pojazd then return end
    
    destroyElement(pojazd)
    
    if getElementData(source, "egzaminP_marker") and isElement(getElementData(source, "egzaminP_marker")) then
        destroyElement(getElementData(source, "egzaminP_marker"))
    end
end)

addEventHandler("onPlayerQuit", root, function()
    local pojazd = getElementData(source, "egzaminP_vehicle")
    if not pojazd then return end
    
    destroyElement(pojazd)
    
    if getElementData(source, "egzaminP_marker") and isElement(getElementData(source, "egzaminP_marker")) then
        destroyElement(getElementData(source, "egzaminP_marker"))
    end
end)

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

-------------------------------------------------------------------------------------



function dajprawko ( policjant, commandName, gracz )
  local accName = getAccountName ( getPlayerAccount ( policjant) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "RCON" ) ) then 
   local gracz1 = getPlayerFromName ( gracz )
   local nickgracza = getPlayerName ( gracz1 )
      local nickpolicjanta = getPlayerName ( policjant )
       local konto = getPlayerAccount ( gracz1 )
       if not getAccountData(konto, "prawojazdy1") then
                 outputChatBox("* Otrzyma?e? prawo jazdy od  "..nickpolicjanta.."", gracz1, 255, 0, 0)
    setAccountData(konto, "prawojazdy", true)
   else
outputChatBox("Gracz "..nickgracza.." posiada prawo jazdy!", policjant)  
end
else
end
   end
   addCommandHandler("dpjB", dajprawko )

   
function sprawdzprawko ( policjant, commandName, gracz )
  local accName = getAccountName ( getPlayerAccount ( policjant) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then 
    local gracz1 = getPlayerFromName ( gracz )  
         local konto = getPlayerAccount ( gracz1 ) 
            local nickgracza = getPlayerName ( gracz1 )
            if not getAccountData(konto, "prawojazdy1") then
            outputChatBox("* Gracz "..nickgracza.." traci prawo jazdy.", policjant) 
            else

                outputChatBox("* Gracz "..nickgracza.." posiada prawo jazdy", policjant, 255, 0, 0)      
end
   else
   end
   end

   addCommandHandler("prawkoB", sprawdzprawko )


function zabierzprawko ( policjant, commandName, gracz )
  local accName = getAccountName ( getPlayerAccount ( policjant) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Administracja" ) ) then 
      local gracz1 = getPlayerFromName ( gracz )  
            local konto = getPlayerAccount ( gracz1 ) 
            local nickgracza = getPlayerName ( gracz1 )
                  local nickpolicjanta = getPlayerName ( policjant )
              if not getAccountData(konto, "prawojazdy") then
            outputChatBox("* Gracz "..nickgracza.." traci prawo jazdy.", policjant, 255, 0, 0) 
            else
            setAccountData(konto, "prawojazdy", false)
        end
      else
   end
   end
   addCommandHandler("prawkoB", zabierzprawko )
         
         
isCar = {[401]=true, [402]=true, [410]=true, [411]=true, [412]=true, [415]=true, [419]=true, [422]=true, [423]=true, [424]=true,
 [429]=true, [434]=true, [436]=true, [439]=true, [444]=true, [451]=true, [467]=true, [474]=true, [475]=true, [477]=true, [478]=true, [480]=true, 
 [489]=true, [491]=true, [494]=true, [495]=true, [496]=true, [500]=true, [502]=true, [503]=true, [504]=true, [505]=true, [506]=true, [508]=true, 
 [517]=true, [518]=true, [525]=true, [526]=true, [527]=true, [533]=true, [534]=true, [535]=true, [536]=true, [541]=true, [542]=true, [543]=true, 
 [545]=true, [549]=true, [552]=true, [554]=true, [555]=true, [558]=true, [559]=true, [562]=true, [565]=true, [568]=true, [574]=true, [575]=true, 
 [576]=true, [587]=true, [589]=true, [600]=true, [602]=true, [603]=true, [400]=true, [404]=true, [405]=true, [409]=true, [413]=true, [418]=true, [420]=true, [421]=true, [426]=true, [428]=true, [431]=true, [438]=true, [440]=true, [442]=true, 
 [445]=true, [458]=true, [459]=true, [466]=true, [467]=true, [470]=true, [479]=true, [482]=true, [483]=true, [492]=true, [507]=true, [516]=true, [529]=true, [540]=true, [546]=true, [547]=true, 
 [550]=true, [551]=true, [560]=true, [561]=true, [566]=true, [567]=true, [579]=true, [580]=true,
}

function prawojazdy ( thePlayer, seat, jacked )
        if (not isCar[getElementModel(source)]) then return end
    local playeraccount = getPlayerAccount ( thePlayer )
    if seat == 0 then
            if not getAccountData(playeraccount, "prawojazdy") then
            outputChatBox ( "* Nie posiadasz prawa jazdy kat. B, b?d? zosta?o ono Ci cofni?te!", thePlayer, 255, 0, 0, true )
                cancelEvent ()
end
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), prawojazdy )


za pomoc piwko

Podpis
, pomogłem Ci? Wynagrodź mnie :piwo: :P
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 12:29


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3


Więcej informacji znajdziesz w Wikipedii MTA:

removePedFromVehicle


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 12:31


Odważny

Początki LUA :P






Wiek: 26
Na forum: 3880 dni
Posty: 140
Nick w MP: ReseT_

Piwa: 166

Respekt: 50

AteX, rozpisz si?

Podpis
, pomogłem Ci? Wynagrodź mnie :piwo: :P
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 12:42


AteX







Wiek: 27
Na forum: 4156 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"Odwa?ny" napisał/a:

AteX, rozpisz si?


Poda?em ci funkcj? z wiki... Na wiki jest wszystko opisane. Nie b?d? specjalnie tego t?umaczy? na polski.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-06, 13:29


MIKAELmta







Wiek: 25
Na forum: 4119 dni
Posty: 311

Piwa: 10631

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


function zabierzprawko ( policjant, commandName, gracz )
  local accName = getAccountName ( getPlayerAccount ( policjant) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Administracja" ) ) then 
      local gracz1 = getPlayerFromName ( gracz )  
            local konto = getPlayerAccount ( gracz1 ) 
            local nickgracza = getPlayerName ( gracz1 )
                  local nickpolicjanta = getPlayerName ( policjant )
              if not getAccountData(konto, "prawojazdy") then
            outputChatBox("* Gracz "..nickgracza.." traci prawo jazdy.", policjant, 255, 0, 0) 
            else
            setAccountData(konto, "prawojazdy", false)
             removePedFromVehicle(gracz1)
        end
      else
   end
   end
   addCommandHandler("prawkoB", zabierzprawko )


Postaw piwo autorowi tego posta
 

 
Tagi: wywalanie :: pojazdu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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