Wysłany: 2017-05-01, 14:28
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
Mam problem z "setMarkerTarget" dok?adnie chodzi mi o to ze nie mog? przez to sko?czy? prawo jazdy prosz? o pomoc
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 ] , "checkpoint" , 3 , 0 , 255 , 255 , 150 )
strzala = setMarkerTarget ( punkt , trasa [ checkpoint + 1 ][ 1 ], trasa [ checkpoint + 1 ][ 2 ], trasa [ checkpoint ][ 3 ])
blip = createBlipAttachedTo ( punkt , 12 )
addEventHandler ( "onClientMarkerHit" , punkt , onCheckpointHit )
end
oraz DB
Wysłany: 2017-05-01, 14:35
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
poniewaz funckja nie wie czym tam jest trasa oraz cheackpoint.
Podpis
"amited" napisał/a :
Wysłany: 2017-05-01, 14:49
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
wytumaczysz mi jak to naprawi? ?
Wysłany: 2017-05-01, 15:13
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
musisz dac trase i cheatpoint na pobliczny czyli bez local przed nimi
Podpis
"amited" napisał/a :
Wysłany: 2017-05-02, 19:04
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
Skrpyt po stronie clienta wygl?da tak
-- kolejne wspolrzedne punktow
trasa = {
{- 2433.10 , 137.52 , 34.64 },
{- 2423.41 , 49.75 , 34.67 },
{- 2490.89 , 42.26 , 25.34 },
{- 2503.28 ,- 18.36 , 25.26 },
{- 2498.41 ,- 67.22 , 25.24 },
{- 2425.34 ,- 72.59 , 34.93 },
{- 2367.20 ,- 72.58 , 34.92 },
{- 2248.50 ,- 72.56 , 34.82 },
{- 2094.59 ,- 72.55 , 34.83 },
{- 2004.19 ,- 44.57 , 34.82 },
{- 2002.75 , 101.94 , 27.19 },
{- 1993.15 , 145.24 , 27.19 },
{- 1999.10 , 186.68 , 27.19 },
{- 2000.17 , 304.51 , 34.48 },
{- 2000.85 , 495.63 , 34.66 },
{- 2069.21 , 507.24 , 34.67 },
{- 2136.70 , 506.92 , 34.67 },
{- 2221.06 , 511.22 , 34.67 },
{- 2231.39 , 566.56 , 34.66 },
{- 2371.14 , 568.79 , 24.39 },
{- 2514.59 , 568.69 , 14.12 },
{- 2596.61 , 568.83 , 14.12 },
{- 2609.33 , 364.80 , 4.74 },
{- 2550.22 , 339.34 , 18.97 },
{- 2579.24 , 228.92 , 9.03 },
{- 2564.10 , 167.27 , 3.93 },
{- 2509.20 , 161.18 , 4.26 },
{- 2257.47 , 318.78 , 34.83 },
{- 2308.31 , 417.21 , 34.66 },
{- 2368.01 , 362.39 , 34.67 },
{- 2419.75 , 187.99 , 34.67 },
{- 2461.36 , 165.84 , 34.69 },
}--{ x , y , z },
-- nasze kategorie oraz ceny
local kategorie = {
{ "A" , 100 },
{ "B" , 0 },
{ "C" , 150 },
{ "D" , 300 },
{ "D+E" , 500 },
}
-- 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 , "Zdawanie prawa jazdy\n Na serwerze San Andreas 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 (PLN)" , 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 )
local row = guiGridListAddRow ( guiprawko [ 3 ])
guiGridListSetItemText ( guiprawko [ 3 ], row , guiprawko [ 4 ], "Kategoria D" , false , false )
guiGridListSetItemText ( guiprawko [ 3 ], row , guiprawko [ 5 ], kategorie [ 4 ][ 2 ], false , false )
local row = guiGridListAddRow ( guiprawko [ 3 ])
guiGridListSetItemText ( guiprawko [ 3 ], row , guiprawko [ 4 ], "Kategoria C+E" , false , false )
guiGridListSetItemText ( guiprawko [ 3 ], row , guiprawko [ 5 ], kategorie [ 5 ][ 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 , d , de )
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 )
elseif text == "Kategoria C+E" then
triggerServerEvent ( "egzaminPrawaJazdy" , localPlayer , "C+E" , cena )
elseif text == "Kategoria D" then
triggerServerEvent ( "egzaminPrawaJazdy" , localPlayer , "D" , 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 ] , "checkpoint" , 3 , 0 , 255 , 255 , 150 )
strzala = setMarkerTarget ( punkt , trasa [ checkpoint + 1 ][ 1 ], trasa [ checkpoint + 1 ][ 2 ], trasa [ checkpoint ][ 3 ])
blip = createBlipAttachedTo ( punkt , 12 )
addEventHandler ( "onClientMarkerHit" , punkt , onCheckpointHit )
end
function usunOstatniCheckpoint ()
if isElement ( punkt ) then
removeEventHandler ( "onClientMarkerHit" , punkt , blip , strzala , onCheckpointHit )
destroyElement ( punkt )
destroyElement ( blip )
destroyElement ( strzala )
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
co mam zmieni? ?
Wysłany: 2017-05-02, 19:12
_Haze
Peace Yo!
Wiek: 24 Na forum: 4185 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
strzala = setMarkerTarget ( punkt , trasa [ checkpoint + 1 ][ 1 ], trasa [ checkpoint + 1 ][ 2 ], trasa [ checkpoint + 1 ][ 3 ])
zapomnia?e? da? +1 w indexie i jak chcesz mo?esz da? takiego ifa
if ( checkpoint + 1 ) <= #trasa then
Więcej szczegółów
Wystawiono 1 piw(a):polaczkos
Wysłany: 2017-05-02, 19:31
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
zrobi?em tak i nie ma ?adnch b??d?w ale uk?czy? prawka si? nie da
[ Dodano : 2017-05-02, 19:33 ]
Ju? dzia?a tylko end w z?ym miejscu da?em leci piwko za pomoc
Tagi: prawko
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: