EvilXmik
Wiek: 28 Na forum: 3620 dni Posty: 148
Nick w MP: EvilXmik
Piwa : 399
Witam mam taki problem i? pr?bowa?em przerobi? ten o to skrypt z aut na samoloty no ale kij z tego wysz?o wi?c zwracam si? do was o pomoc mam nadziej? ?e kto? mi pomo?e
Kod:
--kolejne wspolrzedne punktow
local trasa = {
{331.14,2521.66,17.62},
{406.52,2520.04,17.42},
{415.17,2493.63,17.39},
{227.50,2494.52,22.06},
{-101.72,2516.16,53.80},
{-469.62,2628.77,103.28},
{-1036.08,2706.44,123.19},
{-1489.50,2685.24,126.43},
{-2054.34,2576.14,185.25},
{-2426.47,2433.82,172.17},
{-2529.07,1869.53,113.27},
{-2552.66,1428.96,100.02},
{-2353.43,1129.38,130.42},
{-1898.94,990.85,171.07},
{-1616.00,916.49,172.80},
{-1109.09,757.67,112.79},
{-514.78,667.07,108.58},
{310.23,688.36,80.34},
{676.04,733.93,67.75},
{915.37,784.27,75.93},
{1236.82,978.49,94.99},
{1306.72,1319.95,149.90},
{1244.70,1785.84,222.58},
{1142.23,2023.80,223.29},
{1036.86,2217.57,175.90},
{862.41,2376.28,110.71},
{707.11,2441.82,85.39},
{526.06,2488.73,52.99},
{368.71,2500.40,22.78},
{289.51,2502.47,17.42},
{243.87,2544.52,17.60},
}--{x, y, z}, prosze pamietac o przecinku, dziekuje
--nasze kategorie oraz ceny
local kategorie = {
{"A", 100},
{"B", 50},
{"C", 150},
}
--gui
mojeW,mojeH = 640, 480
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)
local guiprawko = {}
guiprawko[1] = guiCreateWindow(150*width, 65*height, 321*width, 309*height, "Prawo Jazdy", false)
guiWindowSetSizable(guiprawko[1], false)
guiprawko[2] = guiCreateLabel(61*width, 62*height, 204*width, 37*height, "Miendzynarodowy System Prawa Jazdy na serwerze \"7 Life\"", false, guiprawko[1])
guiLabelSetHorizontalAlign(guiprawko[2], "left", true)
guiprawko[3] = guiCreateGridList(45*width, 113*height, 236*width, 132*height, false, guiprawko[1])
guiprawko[4] = guiGridListAddColumn(guiprawko[3], "Kategoria", 0.5)
guiprawko[5] = guiGridListAddColumn(guiprawko[3], "Koszt ($)", 0.5)
local row = guiGridListAddRow (guiprawko[3])
guiGridListSetItemText (guiprawko[3], row, guiprawko[4], "Kategoria A", false, false)
guiGridListSetItemText (guiprawko[3], row, guiprawko[5], kategorie[1][2], false, false)
local row = guiGridListAddRow (guiprawko[3])
guiGridListSetItemText (guiprawko[3], row, guiprawko[4], "Kategoria B", false, false)
guiGridListSetItemText (guiprawko[3], row, guiprawko[5], kategorie[2][2], false, false)
local row = guiGridListAddRow (guiprawko[3])
guiGridListSetItemText (guiprawko[3], row, guiprawko[4], "Kategoria C", false, false)
guiGridListSetItemText (guiprawko[3], row, guiprawko[5], kategorie[3][2], false, false)
guiprawko[6] = guiCreateButton(10*width, 255*height, 122*width, 44*height, "Anuluj", false, guiprawko[1])
guiprawko[7] = guiCreateButton(190*width, 255*height, 121*width, 44*height, "Dalej", false, guiprawko[1])
guiSetVisible(guiprawko[1], false)
addEvent("showGUIPrawko", true)
addEventHandler("showGUIPrawko", getRootElement(),
function(a, b, c)
guiSetVisible(guiprawko[1], true)
showCursor(true)
end)
function onPrawkoZamknij()
guiSetVisible(guiprawko[1], false)
showCursor(false)
end
addEventHandler ("onClientGUIClick", guiprawko[6], onPrawkoZamknij, false)
function onPrawkoDalej()
local row, column = guiGridListGetSelectedItem(guiprawko[3])
if row ~= -1 then
local text = guiGridListGetItemText (guiprawko[3], row, guiprawko[4])
local cena = guiGridListGetItemText (guiprawko[3], row, guiprawko[5])
if tonumber(cena) <= getPlayerMoney(localPlayer) then
if text == "Kategoria A" then
triggerServerEvent("egzaminPrawaJazdy", localPlayer, "A", cena)
elseif text == "Kategoria B" then
triggerServerEvent("egzaminPrawaJazdy", localPlayer, "B", cena)
elseif text == "Kategoria C" then
triggerServerEvent("egzaminPrawaJazdy", localPlayer, "C", cena)
end
else
outputChatBox("Nie posiadasz wystarczaj?co pieni?dzy.", 230, 230, 230, true)
end
end
end
addEventHandler ("onClientGUIClick", guiprawko[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, "checkpoint", 5, 255, 0, 0, 150)
blip = createBlip(trasa[checkpoint][1], trasa[checkpoint][2], trasa[checkpoint][3], 41, 2, 255, 0, 0, 255, 0, 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
Kod:
--lista pojazdow
local blokady = {}
--kategoria A
blokady[448] = "A" -- Pizzaboy
blokady[461] = "A" -- PCJ_600
blokady[462] = "A" -- Faggio
blokady[463] = "A" -- Freeway
blokady[468] = "A" -- Sanchez
blokady[471] = "A" -- Quad
blokady[521] = "A" -- FCR_900
blokady[522] = "A" -- NRG_500
blokady[523] = "A" -- HPV1000
blokady[581] = "A" -- BF_400
blokady[586] = "A" -- Wayfayer
--kategoria B
blokady[400] = "B" -- Landstalker
blokady[401] = "B" -- Bravura
blokady[402] = "B" -- Buffalo
blokady[404] = "B" -- Perenniel
blokady[405] = "B" -- Sentinel
blokady[409] = "B" -- Stretch
blokady[410] = "B" -- Manana
blokady[411] = "B" -- Infernus
blokady[415] = "B" -- Cheetah
blokady[418] = "B" -- Moonbeam
blokady[419] = "B" -- Esperanto
blokady[420] = "B" -- Taxi
blokady[421] = "B" -- Washington
blokady[422] = "B" -- Bobcat
blokady[423] = "B" -- BF_Injection
blokady[426] = "B" -- Premier
blokady[429] = "B" -- Banshee
blokady[434] = "B" -- Hotknife
blokady[436] = "B" -- Previon
blokady[438] = "B" -- Cabbie
blokady[439] = "B" -- Stallion
blokady[442] = "B" -- Romero
blokady[445] = "B" -- Admiral
blokady[451] = "B" -- Turismo
blokady[458] = "B" -- Solair
blokady[466] = "B" -- Glendale
blokady[467] = "B" -- Oceanic
blokady[470] = "B" -- Patriot
blokady[474] = "B" -- Hermes
blokady[475] = "B" -- Sabre
blokady[477] = "B" -- ZR-350
blokady[478] = "B" -- Walton
blokady[479] = "B" -- Regina
blokady[480] = "B" -- Comet
blokady[489] = "B" -- Rancher
blokady[490] = "B" -- FBI Rancher
blokady[491] = "B" -- Virgo
blokady[492] = "B" -- Greenwood
blokady[495] = "B" -- Sandking
blokady[469] = "B" -- Blista_Compact
blokady[496] = "B" -- Mesa
blokady[505] = "B" -- Rancher2
blokady[506] = "B" -- Super_GT
blokady[507] = "B" -- Elegant
blokady[516] = "B" -- Nebula
blokady[517] = "B" -- Majestic
blokady[518] = "B" -- Buccaneer
blokady[526] = "B" -- Fortune
blokady[527] = "B" -- Cadrona
blokady[529] = "B" -- Willard
blokady[531] = "B" -- Tractor
blokady[533] = "B" -- Feltzer
blokady[534] = "B" -- Remington
blokady[535] = "B" -- Slamvan
blokady[536] = "B" -- Blade
blokady[540] = "B" -- Vincent
blokady[541] = "B" -- Bullet
blokady[542] = "B" -- Clover
blokady[543] = "B" -- Sadler
blokady[545] = "B" -- Hustler
blokady[546] = "B" -- Intuder
blokady[547] = "B" -- Primo
blokady[548] = "B" -- Tampa
blokady[550] = "B" -- Sunrise
blokady[551] = "B" -- Merit
blokady[552] = "B" -- Utility_Van
blokady[554] = "B" -- Yosemite
blokady[555] = "B" -- Windsor
blokady[558] = "B" -- Uranus
blokady[559] = "B" -- Jester
blokady[560] = "B" -- Sultan
blokady[561] = "B" -- Stratum
blokady[562] = "B" -- Elegy
blokady[565] = "B" -- Flash
blokady[567] = "B" -- Savanna
blokady[568] = "B" -- Bandito
blokady[575] = "B" -- Broadway
blokady[576] = "B" -- Tornado
blokady[579] = "B" -- Huntley
blokady[580] = "B" -- Stafford
blokady[583] = "B" -- Tug
blokady[585] = "B" -- Emperor
blokady[587] = "B" -- Euros
blokady[589] = "B" -- Club
blokady[596] = "B" -- Police_Car_(LSPD)
blokady[597] = "B" -- Police_Car_(SFPD)
blokady[598] = "B" -- Police_Car_(LVPD)
blokady[599] = "B" -- Police Renger
blokady[600] = "B" -- Picador
blokady[602] = "B" -- Alpha
blokady[603] = "B" -- Phoenix
blokady[604] = "B" -- Glendale_Shit
blokady[605] = "B" -- Sadler_Shit
--kategoria C
blokady[403] = "C" -- Linerunner
blokady[406] = "C" -- Dumper
blokady[408] = "C" -- Trashmaster
blokady[413] = "C" -- Pony
blokady[414] = "C" -- Mule
blokady[416] = "C" -- Ambulance
blokady[423] = "C" -- Mr_Whoopee
blokady[427] = "C" -- Enforcer
blokady[428] = "C" -- Securicar
blokady[431] = "C" -- Bus
blokady[433] = "C" -- Barracks
blokady[437] = "C" -- Coach
blokady[440] = "C" -- Rumpo
blokady[443] = "C" -- Packer
blokady[455] = "C" -- Flatbed
blokady[456] = "C" -- Yankee
blokady[459] = "C" -- Topfun_Van(Berkley's RC)
blokady[470] = "C" -- Patriot
blokady[482] = "C" -- Burrito
blokady[483] = "C" -- Camper
blokady[486] = "C" -- Dozer
blokady[498] = "C" -- Boxville
blokady[499] = "C" -- Benson
blokady[508] = "C" -- Journey
blokady[514] = "C" -- Tanker
blokady[515] = "C" -- Roadtrain
blokady[524] = "C" -- Cement_Truck
blokady[525] = "C" -- Towtruck
blokady[528] = "C" -- FBI_Truck
blokady[532] = "C" -- Combine_Harvester
blokady[544] = "C" -- Firetruck_LA
blokady[573] = "C" -- Dune
blokady[578] = "C" -- DFT_30
blokady[582] = "C" -- Newsvan
blokady[588] = "C" -- Hotdog
blokady[609] = "C" -- Boxville
--markery
local biurkop = createMarker( 358.24,182.70,1007.1, "cylinder", 2, 0,0, 255,255)
setElementInterior(biurkop, 3)
setElementDimension(biurkop, 3)
function onPrawkoHit(hitElement, dim)
if getElementType(hitElement) == "player" then
triggerClientEvent(hitElement, "showGUIPrawko", resourceRoot, false, false, false)
end
end
addEventHandler("onMarkerHit", biurkop, onPrawkoHit)
--// koniec markerow i ich funkcji
local veh = {}
addEvent("egzaminPrawaJazdy", true)
addEventHandler("egzaminPrawaJazdy", 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 == "A" then
veh[source] = createVehicle(586,-2766.78,396.26,4.47, 0, 0,-90)
setElementData(veh[source], "pojazd_opis", "Egzamin prawa jazdy kategori 'A'")
setElementData(veh[source], "pojazdy_paliwo", 50)
elseif kategoria == "B" then
veh[source] = createVehicle(410,-2766.78,396.26,4.47, 0, 0,-90)
setElementData(veh[source], "pojazd_opis", "Egzamin prawa jazdy kategori 'B'")
setElementData(veh[source], "pojazdy_paliwo", 50)
elseif kategoria == "C" then
veh[source] = createVehicle(498, -2766.78,396.26,4.47, 0, 0,-90)
setElementData(veh[source], "pojazd_opis", "Egzamin prawa jazdy kategori 'C'")
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 jazdy (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 jazdy na kategori? "..kategoria..".", source, 230, 230, 230, true)
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 jazdy 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 jazdy 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 jazdy kategorii "..blokada.." by prowadzi? ten pojazd.", player, 230, 230, 230, true)
end
end
end
end
end
addEventHandler ("onVehicleStartEnter", getRootElement(), onBlokadaVeh)
--Komenda sprawdzaj?ca prawo jazdy:
function sprawdzPrawoJazdy(player, cmd, gracz)
if getPlayerTeam(player) == getTeamFromName("Policja") then
if gracz then
local gracz = getPlayerFromName(gracz)
if gracz then
local account = getPlayerAccount(gracz)
if account then
outputChatBox("Wybrany gracz: "..getPlayerName(gracz)..".", player, 240, 240, 240, true)
local a = getAccountData(account, "katA")
if a == true then
ka = "Tak"
else
ka = "Nie"
end
local b = getAccountData(account, "katB")
if b == true then
kb = "Tak"
else
kb = "Nie"
end
local c = getAccountData(account, "katC")
if c == true then
kc = "Tak"
else
kc = "Nie"
end
outputChatBox("Kategoria A: "..ka..".", player, 230, 230, 230, true)
outputChatBox("Kategoria B: "..kb..".", player, 230, 230, 230, true)
outputChatBox("Kategoria C: "..kc..".", player, 230, 230, 230, true)
ka, kb, kc = false, false, false
end
else
outputChatBox("Taki gracz nie istnieje!", player, 230, 230, 230, true)
end
else
outputChatBox("Wpisz /prawo gracz", player, 230, 230, 230, true)
end
end
end
addCommandHandler("prawo", sprawdzPrawoJazdy)
function zabieranie(player,cmd,garcz,kate)
local account = getPlayerAccount(source)
if getPlayerTeam(player) == getTeamFromName("Policja") then
setAccountData(account, "kat"..kate, false)
else
outputChatBox("Nie jeste? z polcji",player,255,255,255,true)
end
end
addCommandHandler("zabierz",zabieranie)
List? tych pojazd?w,markery,itd zamieni? GUI troszki mam problem chocia? wsz?dzie tam gdzie jest "ShowGUIprawko" pozamienia?em na "ShowGUILot" itd ,ale nawet to nie pomaga...sam nwm o co chodzi wi?c nie powiem co jest nie tak heh....Troszki was w trudnym po?o?eniu stawiam ale mam przeczucie ?e teraz te? dacie rad?
[ Dodano : 2016-11-27, 10:03 ]
Dobra ju? sb poradzi?em XD mo?na zankn??