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

Wysłany: 2016-09-17, 20:43


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Witam mam problem z tym skryptem na prawo jazdy chodzi o to ze jak zdam prawko to mog? je zda? po raz kolejny stara?em si? to naprawi? ale co? mi nie wysz?o
Kod:
local prawko = createMarker(358.24,186.27,1008.38-1, "cylinder", 1.5, 64, 255, 0)
setElementInterior(prawko, 3)

local punktyJazdy = {
    {1455.14,-1740.78,13.61},
    {1509.21,-1734.94,13.46},
    {1581.85,-1734.82,13.44},
    {1635.60,-1735.29,13.46},
    {1724.50,-1734.95,13.46},
    {1812.53,-1734.85,13.45},
    {1819.05,-1752.52,13.44},
    {1881.29,-1754.78,13.46},
    {1955.91,-1754.71,13.47},
    {2037.28,-1754.61,13.46},
    {2091.07,-1755.40,13.48},
    {2112.72,-1691.91,13.46},
    {2114.64,-1605.51,24.65},
    {2115.14,-1473.71,23.88},
    {2077.16,-1459.03,23.72},
    {1986.71,-1458.71,13.47},
    {1860.05,-1459.46,13.46},
    {1835.78,-1525.38,13.45},
    {1819.52,-1607.08,13.46},
    {1767.64,-1602.78,13.46},
    {1674.01,-1589.88,13.43},
    {1618.22,-1591.75,13.62},
    {1613.48,-1647.67,13.60},
    {1606.88,-1723.97,13.63},
    {1521.22,-1730.14,13.47},
    {1460.80,-1729.87,13.46},
}

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", 3, 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("|INFO|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(418, 1454.71,-1752.66,13.35,359.7,360.0,360.0)
    setElementData(pojazd, "pojazdy_przebieg", math.random(10000, 20000))
    setElementData(pojazd, "vehicle:fuel", 100)
    setElementData(pojazd, "pojazd_opis", "Egzamin prawa jazdy!\n[UWAGA]")
    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, 3)
    setElementDimension(plr, 0)
    setElementPosition(plr, 369.18,173.70,1008.39)

    if udany then
    setAccountData(getPlayerAccount(plr), "prawojazdy", true)
        outputChatBox("|INFO|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("|INFO|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 ( "Admin" ) ) then 
   local gracz1 = getPlayerFromName ( gracz )
   local nickgracza = getPlayerName ( gracz1 )
      local nickpolicjanta = getPlayerName ( policjant )
       local konto = getPlayerAccount ( gracz1 )
       if not getAccountData(konto, "prawojazdy1") then
         outputChatBox("Da?e? prawo jazdy graczowi "..nickgracza.."", policjant) 
                 outputChatBox("Otrzyma?e? prawo jazdy od Administratora "..nickpolicjanta.."", gracz1)
    setAccountData(konto, "prawojazdy", true)
   else
outputChatBox("Gracz "..nickgracza.." posiada prawo jazdy", policjant)  
end
else
   outputChatBox("Nie jeste? Administratorem!", policjant)
end
   end
   addCommandHandler("dp", 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.." nie posiada prawa jazdy", policjant) 
            else

                outputChatBox("Gracz "..nickgracza.." posiada prawo jazdy", policjant)      
end
   else
   outputChatBox("Nie jeste? policjantem!", policjant)
   end
   end

   addCommandHandler("zobacz.prawko.B", sprawdzprawko )


function zabierzprawko ( policjant, commandName, gracz )
  local accName = getAccountName ( getPlayerAccount ( policjant) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) 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.." nie posiada prawa jazdy", policjant) 
            else
            setAccountData(konto, "prawojazdy", false)
            outputChatBox ("Zabra?e? prawo jazdy graczowi "..gracz1, policjant)
        end
      else
   outputChatBox("Nie jeste? Administratorem!", policjant)
   end
   end
   addCommandHandler("zp", 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,[461]=true, [462]=true, [463]=true, [468]=true, [521]=true, [522]=true,[523]=true, [581]=true, [586]=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!lub zosta?o ono cofni?te!", thePlayer, 255, 255, 255, true )
                cancelEvent ()
end
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), prawojazdy )


Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-09-18, 00:30


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

Przy markerze na start prawka dodaj if kt?ry sprawdza czy konto gracza ma ju? prawko


            local gracz1 = getPlayerFromName ( player )
            local konto = getPlayerAccount ( gracz1 ) 
              if getAccountData(konto, "prawojazdy") then
                 outputChatBox("Posiadasz ju? prawo jazdy!", source)
return end


lub co? w tym stylu

Ostatnio zmieniony przez amited 2016-09-18, 00:39, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-09-23, 21:58


MIKAELmta







Wiek: 25
Na forum: 4119 dni
Posty: 311

Piwa: 10631

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

Zamie?:
if getElementData(el, "prawojazdy") == 1 then

na:
if getElementData(el, "prawojazdy") == 0 then


I czy masz b??dy w db?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-09-23, 22:17


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Ju? poradzi?em sobie z tym problemem ale ka?demu dzi?kuje za pomoc :piwo:

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Tagi: prawo :: jazdy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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