Wysłany: 2015-07-01, 18:31
Mateusz12301
Wiek: 29 Na forum: 4830 dni Posty: 21
Nick w MP: Merson
Mam problem z prawo jazdy, chcia?bym doda? funkcje tak?, ?e jak stukn? wraca mnie z powrotem do miejsca gdzie si? robi prawko, a nie zostawia na ulicy.
Jakiej funkcji do tego u?y??
Wysłany: 2015-07-01, 18:43
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
Mateusz12301 , nie funkcji a bardziej eventu.
i do tego u?yj funkcji:
pobieranie auta gracza
Dawanie elementu zdrowia
Ustawia pozycje elemntu na mapie
Ustawia rotacje elementu
Wysłany: 2015-07-01, 19:31
Mateusz12301
Wiek: 29 Na forum: 4830 dni Posty: 21
Nick w MP: Merson
ale to tylko gracza cofa , tak? Czy i auto?
Wysłany: 2015-07-01, 19:37
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
"Mateusz12301" napisał/a :ale to tylko gracza cofa , tak? Czy i auto?
Najlepiej podaj funkcj? w kt?rej po otrzymaniu obra?e? ko?czy si? egzamin na prawo jazdy, wtedy najlepiej da si? wyt?umaczy? czego musisz u?y? aby? otrzyma? dany efekt.
@Down, my?la?em, ?e ma ju? chocia? jakie? szcz?tki zacz?tej funkcji, a nie zaczynamy od zera
Ostatnio zmieniony przez #404 2015-07-01, 22:30, w całości zmieniany 1 raz
Wysłany: 2015-07-01, 20:00
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
DestroY , co ty gadasz sam autor napisa? ?e chce mie? cofaj?cego auto jak kto? w niego stuknie wi?c anulowanie egzaminu nie ma.
Masz pe?ny kod tylko uzupe?nij:
local x , y , z , = pozycjax , pozycjay , pozycjaz
local rx , ry , rz = rotacjax , rotacjay , rotacjaz
function cancelegzamin ()
local thePlayer = getVehicleOccupant ( source )
if( thePlayer ) then
fixVehicle ( source )
setElementPosition ( source , x , y , z , true )
setElementRotation ( source , rx , ry , rz )
end
end
addEventHandler ( "onVehicleDamage" , getRootElement (), cancelegzamin )
Uzupe?nij tylko warto?ci w zmiennej
Wysłany: 2015-07-01, 21:53
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
Proponuje uzyc spawn player na s-side, gdy? warpPedIntoVehicle buguje sie z setElementPosition, sam do?wiadczy?em tego.
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2015-07-04, 14:04
Mateusz12301
Wiek: 29 Na forum: 4830 dni Posty: 21
Nick w MP: Merson
addEventHandler("onVehicleDamage",root,function(loss)
if getElementData(source,"vehicle:prawko") then
if loss>0.1 then
outputChatBox("Uszkodzi?e? pojazd tak bardzo, ?e egzaminator zabra? Ci pojazd.",getVehicleOccupant(source),255,255,255)
triggerClientEvent("Prawko:Koniec",getVehicleOccupant(source))
destroyElement(veh[getVehicleOccupant(source)])
end
end
end)
Jak w tym miejscu ustawi? , ?eby wraca?o samego gracza po stukni?ciu w miejsce robienia egzaminu:
O to Warto?ci:-2032.4000244141, -99.599998474121, 34.900001525879
Wysłany: 2015-07-04, 21:32
Maximerr
Programmer PHP, LUA
Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa : 1051
addEventHandler ( "onVehicleDamage" , root ,function( loss )
if getElementData ( source , "vehicle:prawko" ) then
if loss > 0.1 then
outputChatBox ( "Uszkodzi?e? pojazd tak bardzo, ?e egzaminator zabra? Ci pojazd." , getVehicleOccupant ( source ), 255 , 255 , 255 )
triggerClientEvent ( "Prawko:Koniec" , getVehicleOccupant ( source ))
setElementPosition ( getVehicleController ( source ), - 2032.4000244141 , - 99.599998474121 , 34.900001525879 )
destroyElement ( veh [ getVehicleOccupant ( source )])
end
end
end )
Spr?buj, aczkolwiek nie jestem pewien...
Wysłany: 2015-07-04, 21:43
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
Maximerr , ?le b?dzie bo ko?czy on egzamin i marker ostatni zostanie ten sam by musia? od nowa egzamin w??czy?.
Wysłany: 2015-07-04, 22:36
Mateusz12301
Wiek: 29 Na forum: 4830 dni Posty: 21
Nick w MP: Merson
Nadal nie dzia?a, pomo?e kto?? :C
Wysłany: 2015-07-05, 00:28
Maximerr
Programmer PHP, LUA
Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa : 1051
addEventHandler ( "onVehicleDamage" , root ,function( loss )
if? getElementData ( source , "vehicle:prawko" )? then
if? loss > 0.1 ? then
outputChatBox ( "Uszkodzi?e??pojazd?tak?bardzo,??e?egzaminator?zabra??Ci?pojazd." , getVehicleOccupant ( source ), 255 , 255 , 255 )
local gracz = getPlayerFromName ( "" .. getPlayerName ( getVehicleController ( source )).. "" )
triggerClientEvent ( "Prawko:Koniec" , getVehicleOccupant ( source ))
setElementPosition ?(? gracz ,?- 2032.4000244141 ,?- 99.599998474121 ,? 34.900001525879 ?)
destroyElement ( veh [ getVehicleOccupant ( source )])
end
end ?
end )
Wysłany: 2015-07-05, 13:37
Mateusz12301
Wiek: 29 Na forum: 4830 dni Posty: 21
Nick w MP: Merson
Nadal nie dzia?a
local pol = dbConnect ( "mysql" , "dbname=" .. dbname .. ";host=" .. host .. "" , "" .. username .. "" , "" .. pass .. "" , "share=1" )
marker = createMarker (- 2032.97 , - 118.12 , 1034.17 , "cylinder" , 1 , 255 , 255 , 255 , 100 )
setElementInterior ( marker , 3 )
setElementData ( marker , "message" , "**Podejd?, aby rozpocz?? teorie prawa jazdy Kat.B**" )
i3 = createPed ( 163 , - 2035.04 , - 118.40 , 1035.17 ,- 90 )
setElementInterior ( i3 , 3 )
setElementData ( i3 , "message" , "Egzaminator" )
i4 = createPed ( 164 , - 2032.43 , - 114.02 , 1035.17 , 180 )
setElementInterior ( i4 , 3 )
setElementData ( i4 , "message" , "Egzaminator" )
ma = createMarker (- 2026.92 , - 103.48 , 1034 , "cylinder" , 7 , 255 , 255 , 255 , 0 )
setElementInterior ( ma , 3 )
setElementData ( ma , "message" , "Prawo Jazdy\nKat.B\nWyj?cie" )
addEventHandler ( "onMarkerHit" , root ,function( e )
if source == marker then
if getAccountData ( getPlayerAccount ( e ), "PJ" ) or getAccountData ( getPlayerAccount ( e ), "Praktyka" ) then return end
setElementData ( e , "trues" , 0 )
local pyt = getElementData ( e , "IDPytania" ) or 0
local pyt = pyt + 1
if pyt > 2 then
pyt = 1
end
setElementData ( e , "IDPytania" , pyt )
local q = dbQuery ( pol , "SELECT * FROM `MTATS_Prawko` WHERE `id`=?" , pyt )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
triggerClientEvent ( "Next" , e , w [ 1 ]. pytanie , w [ 1 ]. odp1 , w [ 1 ]. odp2 , w [ 1 ]. odp3 , w [ 1 ]. poprawne , pyt )
end
end )
addEvent ( "Next2" , true )
addEventHandler ( "Next2" , root ,function()
local q = dbQuery ( pol , "SELECT * FROM `MTATS_Prawko`" )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
local pyt = getElementData ( source , "IDPytania" ) or 0
local pyt = pyt + 1
if pyt > #w then
local pr = getElementData ( source , "trues" ) or 0
if pr == 3 then
outputChatBox ( "Odpowiedzia?e? dobrze na " .. pr .. " pytania z " .. #w..". Gratulujemy zdania cz??ci teoretycznej. Przeloguj si? i zacznij test praktyczny.",source,255,255,255)
setAccountData ( getPlayerAccount ( source ), "Praktyka" , true )
setElementData ( source , "Praktyka" , true )
elseif pr < 3 then
outputChatBox ( "Odpowiedzia?e? dobrze na " .. pr .. " pytania z " .. #w..". Niestety, ?yczymy szcz??cia innym razem!",source,255,255,255)
end
return triggerClientEvent ( "Close" , source )
end
setElementData ( source , "IDPytania" , pyt )
local q = dbQuery ( pol , "SELECT * FROM `MTATS_Prawko` WHERE `id`=?" , pyt )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
triggerClientEvent ( "Next" , source , w [ 1 ]. pytanie , w [ 1 ]. odp1 , w [ 1 ]. odp2 , w [ 1 ]. odp3 , w [ 1 ]. poprawne , pyt )
end )
veh ={}
addEvent ( "Prawko:Pojazd" , true )
addEventHandler ( "Prawko:Pojazd" , root ,function()
veh [ source ]= createVehicle ( 589 ,- 2032.4000244141 , - 99.599998474121 , 34.900001525879 )
setElementRotation ( veh [ source ], 0 , 0 , 90 )
setElementInterior ( source , 0 )
warpPedIntoVehicle ( source , veh [ source ])
setVehicleHandling ( veh [ source ], "maxVelocity" , 50 )
setElementData ( veh [ source ], "message" , "Pojazd egzaminacyjny\n**Zakaz uszkadzania**" )
setElementData ( veh [ source ], "vehicle:dontsave" , true )
setElementData ( veh [ source ], "vehicle:prawko" , true )
setElementData ( source , "player:zdajacy" , true )
end )
addEvent ( "Prawko:Zakoncz" , true )
addEventHandler ( "Prawko:Zakoncz" , root ,function()
destroyElement ( veh [ source ])
givePlayerMoney ( source , 50 )
setElementData ( source , "player:zdajacy" , false )
for _ , v in ipairs ( getElementsByType ( "player" )) do
end
end )
addEventHandler ( "onVehicleDamage" , root ,function( loss )
if getElementData ( source , "vehicle:prawko" ) then
if loss > 0.1 then
outputChatBox ( "Uszkodzi?e? pojazd tak bardzo, ?e egzaminator zabra? Ci pojazd." , getVehicleOccupant ( source ), 255 , 255 , 255 )
local gracz = getPlayerFromName ( "" .. getPlayerName ( getVehicleController ( source )).. "" )
triggerClientEvent ( "Prawko:Koniec" , getVehicleOccupant ( source ))
setElementPosition ( gracz , - 2032.4000244141 , - 99.599998474121 , 34.900001525879 )
destroyElement ( veh [ getVehicleOccupant ( source )])
end
end
end )
addEventHandler ( "onPlayerVehicleExit" , root ,function( vehicle , seat )
if seat == 0 then
if getElementData ( vehicle , "vehicle:prawko" ) then
outputChatBox ( "Wyszed?e? z pojazdu ko?cz?c sw?j kurs. Nie r?b tego na przysz?o??." , source , 255 , 255 , 255 )
destroyElement ( veh [ source ])
triggerClientEvent ( "Prawko:Koniec" , source )
end
end
end )
addEventHandler ( "onPlayerLogin" , root ,function( _ , konto )
if getAccountData ( konto , "PJ" ) then
setElementData ( source , "PJ" , true )
end
if getAccountData ( konto , "Praktyka" ) then
setElementData ( source , "Praktyka" , true )
end
end )
addEventHandler ( "onVehicleStartEnter" , root ,function( e , seat )
if seat == 0 then
if not getAccountData ( getPlayerAccount ( e ), "PJ" ) then
cancelEvent ()
outputChatBox ( "Nie posiadasz kluczy do tego pojazdu." , e , 255 , 255 , 255 )
end
end
end )
To jest pod server wszystko, pomo?e kto? z tym bo mam i to wielki problem, ?ecy gracza przywr?ci?o po stukni?ciu :C
Wysłany: 2015-07-05, 16:33
Maximerr
Programmer PHP, LUA
Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa : 1051
local pol = dbConnect ( "mysql" , "dbname=" .. dbname .. ";host=" .. host .. "" , "" .. username .. "" , "" .. pass .. "" , "share=1" )
marker = createMarker (- 2032.97 , - 118.12 , 1034.17 , "cylinder" , 1 , 255 , 255 , 255 , 100 )
setElementInterior ( marker , 3 )
setElementData ( marker , "message" , "**Podejd?, aby rozpocz?? teorie prawa jazdy Kat.B**" )
i3 = createPed ( 163 , - 2035.04 , - 118.40 , 1035.17 ,- 90 )
setElementInterior ( i3 , 3 )
setElementData ( i3 , "message" , "Egzaminator" )
i4 = createPed ( 164 , - 2032.43 , - 114.02 , 1035.17 , 180 )
setElementInterior ( i4 , 3 )
setElementData ( i4 , "message" , "Egzaminator" )
ma = createMarker (- 2026.92 , - 103.48 , 1034 , "cylinder" , 7 , 255 , 255 , 255 , 0 )
setElementInterior ( ma , 3 )
setElementData ( ma , "message" , "Prawo Jazdy\nKat.B\nWyj?cie" )
addEventHandler ( "onMarkerHit" , root ,function( e )
if source == marker then
if getAccountData ( getPlayerAccount ( e ), "PJ" ) or getAccountData ( getPlayerAccount ( e ), "Praktyka" ) then return end
setElementData ( e , "trues" , 0 )
local pyt = getElementData ( e , "IDPytania" ) or 0
local pyt = pyt + 1
if pyt > 2 then
pyt = 1
end
setElementData ( e , "IDPytania" , pyt )
local q = dbQuery ( pol , "SELECT * FROM `MTATS_Prawko` WHERE `id`=?" , pyt )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
triggerClientEvent ( "Next" , e , w [ 1 ]. pytanie , w [ 1 ]. odp1 , w [ 1 ]. odp2 , w [ 1 ]. odp3 , w [ 1 ]. poprawne , pyt )
end
end )
addEvent ( "Next2" , true )
addEventHandler ( "Next2" , root ,function()
local q = dbQuery ( pol , "SELECT * FROM `MTATS_Prawko`" )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
local pyt = getElementData ( source , "IDPytania" ) or 0
local pyt = pyt + 1
if pyt > #w then
local pr = getElementData ( source , "trues" ) or 0
if pr == 3 then
outputChatBox ( "Odpowiedzia?e? dobrze na " .. pr .. " pytania z " .. #w..". Gratulujemy zdania cz??ci teoretycznej. Przeloguj si? i zacznij test praktyczny.",source,255,255,255)
setAccountData ( getPlayerAccount ( source ), "Praktyka" , true )
setElementData ( source , "Praktyka" , true )
elseif pr < 3 then
outputChatBox ( "Odpowiedzia?e? dobrze na " .. pr .. " pytania z " .. #w..". Niestety, ?yczymy szcz??cia innym razem!",source,255,255,255)
end
return triggerClientEvent ( "Close" , source )
end
setElementData ( source , "IDPytania" , pyt )
local q = dbQuery ( pol , "SELECT * FROM `MTATS_Prawko` WHERE `id`=?" , pyt )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
triggerClientEvent ( "Next" , source , w [ 1 ]. pytanie , w [ 1 ]. odp1 , w [ 1 ]. odp2 , w [ 1 ]. odp3 , w [ 1 ]. poprawne , pyt )
end )
veh ={}
addEvent ( "Prawko:Pojazd" , true )
addEventHandler ( "Prawko:Pojazd" , root ,function()
veh [ source ]= createVehicle ( 589 ,- 2032.4000244141 , - 99.599998474121 , 34.900001525879 )
setElementRotation ( veh [ source ], 0 , 0 , 90 )
setElementInterior ( source , 0 )
warpPedIntoVehicle ( source , veh [ source ])
setVehicleHandling ( veh [ source ], "maxVelocity" , 50 )
setElementData ( veh [ source ], "message" , "Pojazd egzaminacyjny\n**Zakaz uszkadzania**" )
setElementData ( veh [ source ], "vehicle:dontsave" , true )
setElementData ( veh [ source ], "vehicle:prawko" , true )
setElementData ( source , "player:zdajacy" , true )
end )
addEvent ( "Prawko:Zakoncz" , true )
addEventHandler ( "Prawko:Zakoncz" , root ,function()
destroyElement ( veh [ source ])
givePlayerMoney ( source , 50 )
setElementData ( source , "player:zdajacy" , false )
end )
addEventHandler ( "onVehicleDamage" , root ,function( loss )
if getElementData ( source , "vehicle:prawko" ) then
if loss > 0.1 then
outputChatBox ( "Uszkodzi?e? pojazd tak bardzo, ?e egzaminator zabra? Ci pojazd." , getVehicleOccupant ( source ), 255 , 255 , 255 )
local gracz = getPlayerFromName ( "" .. getPlayerName ( getVehicleController ( source )).. "" )
triggerClientEvent ( "Prawko:Koniec" , getVehicleOccupant ( source ))
destroyElement ( veh [ getVehicleOccupant ( source )])
for _ , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:zdajacy" ) then
setElementPosition ( v , - 2032.4000244141 , - 99.599998474121 , 34.900001525879 )
end
end
end
end
end )
addEventHandler ( "onPlayerVehicleExit" , root ,function( vehicle , seat )
if seat == 0 then
if getElementData ( vehicle , "vehicle:prawko" ) then
outputChatBox ( "Wyszed?e? z pojazdu ko?cz?c sw?j kurs. Nie r?b tego na przysz?o??." , source , 255 , 255 , 255 )
destroyElement ( veh [ source ])
triggerClientEvent ( "Prawko:Koniec" , source )
end
end
end )
addEventHandler ( "onPlayerLogin" , root ,function( _ , konto )
if getAccountData ( konto , "PJ" ) then
setElementData ( source , "PJ" , true )
end
if getAccountData ( konto , "Praktyka" ) then
setElementData ( source , "Praktyka" , true )
end
end )
addEventHandler ( "onVehicleStartEnter" , root ,function( e , seat )
if seat == 0 then
if not getAccountData ( getPlayerAccount ( e ), "PJ" ) then
cancelEvent ()
outputChatBox ( "Nie posiadasz kluczy do tego pojazdu." , e , 255 , 255 , 255 )
end
end
end )
Wysłany: 2015-07-07, 17:21
Mateusz12301
Wiek: 29 Na forum: 4830 dni Posty: 21
Nick w MP: Merson
Wysłany: 2015-07-07, 17:46
Maximerr
Programmer PHP, LUA
Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa : 1051
Mateusz12301 , jest jaki? DB3?
Tagi: prawo :: jazdy.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: