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

Wysłany: 2016-02-14, 21:31


EseJax







Wiek: 31
Na forum: 4085 dni
Posty: 67
Nick w MP: Toffy.

Piwa: 982

Respekt: 55,3

Ostrzeżeń: 100%
Witam ponownie, tworze ma?e zabezpieczenie do systemu pojazd?w ourgame lecz mam pewien problem..

function prawojazdy(theVehicleplrseatjacked)
    if seat == 0 then
    if (getVehicleType(theVehicle) == "Automobile") and (getVehicleType(theVehicle) == "Quad"then
    if plr:getData('player:lic:pjC') == or plr:getData('player:lic:pjB') == 0 then
    outputChatBox "Nie posiadasz prawa jazdy kategorii B oraz C lub zosta?o ono cofni?te!"source255255255true )
    cancelEvent ()
end
end
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), prawojazdy )

Nie ma ?adnych b??d?w ale nie maj?c prawka moge normalnie wsiada?.
(Posiadam prawko C, ale chcia?em zrobi? tak ze trzeba mie? oba prawka aby m?c wsiada?.)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-14, 22:46


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
EseJax, masz w??czone programowanie objektowe ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-14, 22:50


EseJax







Wiek: 31
Na forum: 4085 dni
Posty: 67
Nick w MP: Toffy.

Piwa: 982

Respekt: 55,3

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

EseJax, masz w??czone programowanie objektowe ?

<oop>true</oop> - Tak.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-14, 22:55


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
Doczytaj jakie parametry zwraca ten event a zrozumiesz b??d, na wiki wszystko b?dziesz mia?.

I ps: pojazd nie b?dzie w 2 kategoriach, musisz tam zamiast and uzyc or

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-14, 23:08


Loop

Inspektor






Wiek: 27
Na forum: 4289 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130


function prawojazdy(plrseat)
    if seat == 0 then
    if not (getVehicleType(source) == "Automobile") or (getVehicleType(source) == "Quad"then return end
    if plr:getData('player:lic:pjC') == and plr:getData('player:lic:pjB') == 0 then
    outputChatBox "Nie posiadasz prawa jazdy kategorii B oraz C lub zosta?o ono cofni?te!"plr255255255true )
    cancelEvent ()
end
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), prawojazdy )


Sprawdz powinno dzia?a?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-14, 23:21


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
Loop, chyba tylko jedna poprawka


    if not (getVehicleType(source) == "Automobile") or not (getVehicleType(source) == "Quad"then return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-15, 01:36


EseJax







Wiek: 31
Na forum: 4085 dni
Posty: 67
Nick w MP: Toffy.

Piwa: 982

Respekt: 55,3

Ostrzeżeń: 100%

katA = {[461]=true, [462]=true, [463]=true, [468]=true, [521]=true, [522]=true,[523]=true, [581]=true, [586]=true
}
katC = {[403]=true, [406]=true, [413]=true, [414]=true, [416]=true, [423]=true,[428]=true, [431]=true, [433]=true, [437]=true, [440]=true, [455]=true,[456]=true, [459]=true, [482]=true, [498]=true, [499]=true, [508]=true, [514]=true, [515]=true, [524]=true, [538]=true, [573]=true
}
katB = {[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,
}
katL = {[592]=true, [553]=true, [577]=true, [488]=true, [511]=true, [497]=true, [548]=true, [563]=true, [512]=true, [476]=true, [593]=true, [447]=true, [425]=true, [519]=true, [520]=true, [460]=true, [417]=true, [469]=true, [487]=true, [513]=true
}

function prawojazdy(plrseat)
    if (not katC[getElementModel(source)]) then return end
    if seat == 0 then
    local pjC=getElementData(plr,"player:lic:pjC")
    if pjC or tonumber(pjC) ~= 1 then return end
    outputChatBox "Nie posiadasz prawa jazdy kategorii C b?d? zosta?o ono cofni?te!"plr255255255true )
    cancelEvent ()
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), prawojazdy )

function prawojazdy2(plrseat)
    if (not katB[getElementModel(source)]) then return end
    if seat == 0 then
    local pjB=getElementData(plr,"player:lic:pjB")
    if pjB or tonumber(pjB) ~= 1 then return end
    outputChatBox "Nie posiadasz prawa jazdy kategorii B b?d? zosta?o ono cofni?te!"plr255255255true )
    cancelEvent ()
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), prawojazdy2 )

function prawojazdy3(plrseat)
    if (not katA[getElementModel(source)]) then return end
    if seat == 0 then
    local pjA=getElementData(plr,"player:lic:pjA")
    if pjA or tonumber(pjA) ~= 1 then return end
    outputChatBox "Nie posiadasz prawa jazdy kategorii A b?d? zosta?o ono cofni?te!"plr255255255true )
    cancelEvent ()
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), prawojazdy3 )

function prawojazdy4(plrseat)
    if (not katL[getElementModel(source)]) then return end
    if seat == 0 then
    local pjL=getElementData(plr,"player:lic:pjL")
    if pjL or tonumber(pjL) ~= 1 then return end
    outputChatBox "Nie posiadasz licencji aby m?c prowadzi? samoloty/helikoptery!"plr255255255true )
    cancelEvent ()
end
end
addEventHandler "onVehicleStartEnter"getRootElement(), prawojazdy4 )

Zrobi?em takie co?, ale i tak nie maj?c prawka mog? wsiada? do pojazd?w

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-15, 23:16


Loop

Inspektor






Wiek: 27
Na forum: 4289 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

addEventHandler("onVehicleStartEnter"root, function(plrseat)
if seat == 0 then
if not katC[getElementModel(source)] then return end
if getElementData(plr"player:lic:pjC") == 0 then 
            outputChatBox("* Nie posiadasz Prawa Jazdy kat. C."plr)
            cancelEvent()
        end
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-16, 00:35


EseJax







Wiek: 31
Na forum: 4085 dni
Posty: 67
Nick w MP: Toffy.

Piwa: 982

Respekt: 55,3

Ostrzeżeń: 100%
Ju? dawno sobie poradzi?em, zapomnia?em napisa? - do zamkni?cia.

Postaw piwo autorowi tego posta
 

 
Tagi: prawojazdy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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