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

Wysłany: 2017-01-29, 14:09


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

zrobi?em taki skrypt na licencje lotnicze i nie dzia?a podpowie kto? co jest ?le ?

serwer

--lista pojazdow 
local blokady = {} 

--kategoria L1
blokady[593] = "L1" -- dodo 
 

--kategoria L2
blokady[520] = "L2" -- hydra 
blokady[577] = "L2" -- AT
blokady[512] = "L2" -- cropduster
blokady[553] = "L2" -- Nevada
blokady[476] = "L2" -- Rustler
blokady[519] = "L2" -- Shamal
blokady[460] = "L2" -- Skimmer
blokady[513] = "L2" -- Stunplane


--markery 

local biurkop = createMarker( 358.77,186.47,1007.38, "cylinder", 2, 0,0, 255,255) 
setElementInterior(biurkop, 3) 
setElementDimension(biurkop, 3) 

function onPrawkoHit(hitElement, dim) 
if getElementType(hitElement) == "player" then 
triggerClientEvent(hitElement, "showGUILot", resourceRoot, false, false, false) 
end 
end 
addEventHandler("onMarkerHit", biurkop, onPrawkoHit) 
--// koniec markerow i ich funkcji 
local veh = {} 

addEvent("egzaminPrawaLot", true) 
addEventHandler("egzaminPrawaLot", getRootElement(), 
function(kategoria, cena) 
local account = getPlayerAccount(source) 
if account then 
local data = getAccountData(account, "kat"..kategoria) 
if not data or data == false or data == nil then 
if not veh[source] then 
if kategoria == "L1" then 
veh[source] = createVehicle(593,324.99,2541.45,17.20, 0, 0,-180) 
setElementDimension(source, 0) 
setElementInterior(source, 0) 
setElementData(veh[source], "vopis", "Egzamin prawa Lotniczego kategori 'L1'") 
setElementData(veh[source], "pojazdy_paliwo", 50) 
if kategoria == "L2" then 
veh[source] = createVehicle(520,324.99,2541.45,17.20, 0, 0,-90) 
setElementDimension(source, 0)
setElementInterior(source, 0)  
setElementData(veh[source], "vopis", "Egzamin prawa Lotniczego kategori 'L2'") 
setElementData(veh[source], "pojazdy_paliwo", 50)
if kategoria == "H1" then 
veh[source] = createVehicle(520,324.99,2541.45,17.20, 0, 0,-90) 
setElementDimension(source, 0)
setElementInterior(source, 0)  
setElementData(veh[source], "vopis", "Egzamin prawa Lotniczego kategori 'H1'") 
setElementData(veh[source], "pojazdy_paliwo", 50) 
elseif kategoria == "H2" then 
veh[source] = createVehicle(520,324.99,2541.45,17.20, 0, 0,-90) 
setElementDimension(source, 0) 
setElementInterior(source, 0) 
setElementData(veh[source], "vopis", "Egzamin prawa Lotniczego kategori 'H2'") 
setElementData(veh[source], "pojazdy_paliwo", 50) 
end 
takePlayerMoney(source, cena) 
setElementInterior(source, 0) 
warpPedIntoVehicle (source, veh[source]) 
triggerClientEvent(source, "startEgzamin", resourceRoot, veh[source]) 
outputChatBox("Rozpocz??e? egzamin na prawo Lotniczego (kategoria "..kategoria..").", source, 230, 230, 230, true) 
setElementData(source, "egzamin", kategoria) 
else 
outputChatBox("Rozpocz??e? ju? jeden egzamin.", source, 230, 230, 230, true) 
end 
else 
outputChatBox("Posiadasz ju? prawo Lotnicze na kategori? "..kategoria..".", source, 230, 230, 230, true) 
end 
end 
end
end
end)

addEvent("egzaminZdany", true) 
addEventHandler("egzaminZdany", getRootElement(), 
function() 
if isElement(veh[source]) then 
destroyElement(veh[source]) 
end 

local kat = getElementData(source, "egzamin") 
local account = getPlayerAccount(source) 
if account then 
setAccountData(account, "kat"..kat, true) 
outputChatBox("Gratulacje! Zda?e? prawo Lotnicze na kategori? "..kat.."!", source, 230, 230, 230, true) 
setElementData(source, "egzamin", false) 
warpToSzkolaJazdy(source) 
end 
end) 

addEvent("egzaminOblany", true) 
addEventHandler("egzaminOblany", getRootElement(), 
function() 
if isElement(veh[source]) then 
destroyElement(veh[source]) 
end 

local kat = getElementData(source, "egzamin") 
local account = getPlayerAccount(source) 
if account then 
setAccountData(account, "kat"..kat, false) 
outputChatBox("Niestety, nie uda?o Ci si? zda? prawa Lotniczego na kategorie "..kat.."!", source, 230, 230, 230, true)
setElementData(source, "egzamin", false) 
warpToSzkolaJazdy(source) 
end 
end) 

function warpToSzkolaJazdy(player) 
removePedFromVehicle (player) 
veh[player] = false 
setElementInterior(player, 3) 
setElementDimension(player, 3) 
setElementPosition(player, 367.19,182.55,1008.38) 
setElementRotation(player, 0, 0, 0) 
end 

--blokada wchodzenia 

function onBlokadaVeh(player, seat, jacked) 
local id = getElementModel(source) 
local blokada = blokady[id] 
if blokada then 
if (seat == 0) then 
local account = getPlayerAccount(player) 
if account then 
local kategoria = getAccountData(account, "kat"..blokada) 
if kategoria ~= true then 
cancelEvent() 
outputChatBox ("Potrzebujesz prawa Lotniczego kategorii "..blokada.." by prowadzi? ten pojazd.", player, 230, 230, 230, true) 
end 
end 
end 
end 
end 
addEventHandler ("onVehicleStartEnter", getRootElement(), onBlokadaVeh) 



strona clienta

--kolejne wspolrzedne punktow 
local trasa = { 
{326.33,2522.63,-23.0},
{421.72,2522.38,-23.0},
{407.40,2500.01,-23.0},
{271.71,2503.65,-18.88},
{-23.05,2513.72,61.70},
{-266.89,2572.74,99.48},
{-606.13,2673.00,114.89},
{-921.04,2710.44,114.89},
{-1251.28,2669.80,114.89},
{-1429.81,2486.61,114.89},
{-1366.73,2183.62,114.89},
{-1230.87,1883.49,114.89},
{-951.19,1708.86,114.89},
{-495.42,1675.43,114.89},
{-126.05,1717.60,114.89},
{225.69,1889.74,114.89},
{551.05,2032.26,114.89},
{726.86,2119.09,114.89},
{930.95,2223.35,108.26},
{1038.98,2371.99,92.44},
{765.81,2473.53,67.05},
{509.34,2494.50,49.85},
{391.92,2503.73,-18.0},
{311.32,2505.43,-23.0},
{290.47,2544.32,-23.0},
}--{x, y, z}, prosze pamietac o przecinku, dziekuje 

--nasze kategorie oraz ceny 
local kategorie = { 
{"L1", 700}, 
{"L2", 1500}, 
{"H1", 500},
{"H2", 1000},
} 

--gui 
mojeW,mojeH = 640, 480 
sW,sH = guiGetScreenSize() 
width, height = (sW/mojeW), (sH/mojeH) 

local guiLot = {} 
guiLot[1] = guiCreateWindow(150*width, 65*height, 321*width, 309*height, "Prawo Lotnicze", false) 
guiWindowSetSizable(guiLot[1], false) 

guiLot[2] = guiCreateLabel(61*width, 62*height, 204*width, 37*height, "Zdawanie prawa Lotniczego\n Na serwerze San Andreas Life", false, guiLot[1]) 
guiLabelSetHorizontalAlign(guiLot[2], "left", true) 
guiLot[3] = guiCreateGridList(45*width, 113*height, 236*width, 132*height, false, guiLot[1]) 
guiLot[4] = guiGridListAddColumn(guiLot[3], "Kategoria", 0.5) 
guiLot[5] = guiGridListAddColumn(guiLot[3], "Koszt (PLN)", 0.5) 

local row = guiGridListAddRow (guiLot[3]) 
guiGridListSetItemText (guiLot[3], row, guiLot[4], "Kategoria L1", false, false) 
guiGridListSetItemText (guiLot[3], row, guiLot[5], kategorie[1][2], false, false) 
local row = guiGridListAddRow (guiLot[3]) 
guiGridListSetItemText (guiLot[3], row, guiLot[4], "Kategoria L2", false, false) 
guiGridListSetItemText (guiLot[3], row, guiLot[5], kategorie[2][2], false, false) 
local row = guiGridListAddRow (guiLot[3])
guiGridListSetItemText (guiLot[3], row, guiLot[4], "Kategoria H1", false, false) 
guiGridListSetItemText (guiLot[3], row, guiLot[5], kategorie[3][2], false, false) 
local row = guiGridListAddRow (guiLot[3]) 
guiGridListSetItemText (guiLot[3], row, guiLot[4], "Kategoria H2", false, false) 
guiGridListSetItemText (guiLot[3], row, guiLot[5], kategorie[4][2], false, false) 
local row = guiGridListAddRow (guiLot[3])  

guiLot[6] = guiCreateButton(10*width, 255*height, 122*width, 44*height, "Anuluj", false, guiLot[1]) 
guiLot[7] = guiCreateButton(190*width, 255*height, 121*width, 44*height, "Dalej", false, guiLot[1]) 
guiSetVisible(guiLot[1], false) 

addEvent("showGUILot", true) 
addEventHandler("showGUILot", getRootElement(), 
function(a, b, c, d , de) 
guiSetVisible(guiLot[1], true) 
showCursor(true) 
end) 

function onPrawkoZamknij() 
guiSetVisible(guiLot[1], false) 
showCursor(false) 
end 
addEventHandler ("onClientGUIClick", guiLot[6], onPrawkoZamknij, false) 

function onPrawkoDalej() 
local row, column = guiGridListGetSelectedItem(guiLot[3]) 
if row ~= -1 then 
local text = guiGridListGetItemText (guiLot[3], row, guiLot[4]) 
local cena = guiGridListGetItemText (guiLot[3], row, guiLot[5]) 
if tonumber(cena) <= getPlayerMoney(localPlayer) then 
if text == "Kategoria L1" then 
triggerServerEvent("egzaminPrawaLot", localPlayer, "L1", cena) 
if text == "Kategoria L2" then 
triggerServerEvent("egzaminPrawaLot", localPlayer, "L2", cena)
if text == "Kategoria H1" then 
triggerServerEvent("egzaminPrawaLot", localPlayer, "H1", cena) 
elseif text == "Kategoria H2" then 
triggerServerEvent("egzaminPrawaLot", localPlayer, "H2", cena)  
end 
else 
outputChatBox("Nie posiadasz wystarczaj?co pieni?dzy.", 230, 230, 230, true) 
end 
end 
end 
end
end
addEventHandler ("onClientGUIClick", guiLot[7], onPrawkoDalej, false) 

--egzamin 
addEvent("startEgzamin", true) 
addEventHandler("startEgzamin", getRootElement(), 
function(veh) 
onPrawkoZamknij() 

SAVEVEH = veh --zapisuje sobie moj pojazd 
checkpoint = 1 
stworzNowyCheckpoint() 

addEventHandler("onClientVehicleExit", resourceRoot, function(player, seat) 
if seat == 0 then 
triggerServerEvent("egzaminOblany", localPlayer) 
usunOstatniCheckpoint() 
checkpoint = false 
SAVEVEH = false 
end 
end) 


--4. sek po respie auta mozna dopiero oblac - dla bezpieczenstwa przy respawnie 
setTimer(function() 
fixVehicle(SAVEVEH) 
addEventHandler("onClientVehicleCollision", SAVEVEH, onVehicleCollision) 
end, 4000, 1) 
end) 

function stworzNowyCheckpoint(source) 
if isElement(punkt) then 
removeEventHandler("onClientMarkerHit", punkt, onCheckpointHit) 

destroyElement(punkt) 
destroyElement(blip) 
end 

punkt = createMarker (trasa[checkpoint][1], trasa[checkpoint][2], trasa[checkpoint][3] + 40, "ring", 4, 0, 0, 255,255)
blip = createBlip(trasa[checkpoint][1], trasa[checkpoint][2], trasa[checkpoint][3], trasa[checkpoint][4], trasa[checkpoint][5], 41, 2, 255, 255, 255, 255, 255, 350) 

addEventHandler("onClientMarkerHit", punkt, onCheckpointHit) 
end 

function usunOstatniCheckpoint() 
if isElement(punkt) then 
removeEventHandler("onClientMarkerHit", punkt, onCheckpointHit) 

destroyElement(punkt) 
destroyElement(blip) 
end 
end 

function onCheckpointHit(hitElement) 
if localPlayer == hitElement then 
checkpoint = checkpoint + 1 
if checkpoint > #trasa then 
triggerServerEvent("egzaminZdany", localPlayer) 
zakonczEgzamin() 
else 
stworzNowyCheckpoint() 
end 
end 
end 

function onVehicleCollision(element, loss) 
if loss > 50 then 
triggerServerEvent("egzaminOblany", localPlayer) 
zakonczEgzamin() 
end 
end 

function zakonczEgzamin() 
removeEventHandler("onClientVehicleCollision", SAVEVEH, onVehicleCollision) 
usunOstatniCheckpoint() 
checkpoint = false 
SAVEVEH = false 
end 


za pomoc leci piwko i respekt

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-29, 14:22


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

polaczkos, Podaj b??d z db3

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-29, 14:38


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

W?anie nie ma ?adnego b??du

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-29, 14:53


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

polaczkos, Wi?c napisz w kt?rym momencie kod przestaje dzia?a? lub dzia?a tak jak nie powinien.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-30, 17:50


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

jak chcem rozpocz?? dan? licencje nic sie nie dzieje i nie wiem czemu to nie dzia?a

Postaw piwo autorowi tego posta
 

 
Tagi: licencje :: lotnicze
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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