Wysłany: 2018-01-30, 20:46
CjPomarancza
:-)
Wiek: 17 Na forum: 3183 dni Posty: 90
Piwa : 12
Witam. Postanowi?em, ?e spr?buje zrobi? ju? jaki? bardziej zaawansowany skrypt, z tabelami etc. Decyzja pad?a na prace dowozu z punktu A do B, lecz pojawi? si? pewien b??d.
Ot?? gdy marker na stacji zostaje uderzony przez cysterne, to nic si? nie dzieje. DB3 nic nie pokazuje.
SERVERSIDE
local cysterny = {
{ 285.1064453125 , 1450.04296875 , 10.5859375 , 0 , 0 , 90.888763427734 },
}
local punktPaliwa = {
{ 251.6298828125 , 1444.447265625 , 10.5859375 },
{ 249.7373046875 , 1420.27734375 , 10.549697875977 },
{ 250.15625 , 1395.7998046875 , 10.5859375 },
{ 248.2568359375 , 1371.349609375 , 10.5859375 },
}
local n = 1
local markerek = createMarker ( cysterny [ n ][ 1 ]- 1.5 , cysterny [ n ][ 2 ], cysterny [ n ][ 3 ], "cylinder" , 6 , 100 , 100 , 100 , 0 )
local napelnianie = createMarker ( punktPaliwa [ n ][ 1 ], punktPaliwa [ n ][ 2 ], punktPaliwa [ n ][ 3 ], "corona" , 8 , 255 , 0 , 100 )
setElementVisibleTo ( napelnianie , root , false )
blipek = createBlipAttachedTo ( napelnianie , 12 )
setElementVisibleTo ( blipek , root , false )
local cystka = createVehicle ( getVehicleModelFromName ( "Dune" ), cysterny [ n ][ 1 ], cysterny [ n ][ 2 ], cysterny [ n ][ 3 ], cysterny [ n ][ 4 ], cysterny [ n ][ 5 ], cysterny [ n ][ 6 ])
setElementData ( cystka , "duniacz" , true )
addEventHandler ( "onVehicleEnter" , cystka , function( sr )
setElementVisibleTo ( napelnianie , root , true )
setElementVisibleTo ( blipek , root , true )
end )
addEventHandler ( "onVehicleExit" , cystka , function( sr )
setElementVisibleTo ( napelnianie , root , false )
setElementVisibleTo ( blipek , root , false )
setTimer (function()
destroyElement ( cystka )
end , 10 * 1000 , 1 )
end )
function wyjscie ( lE , md , sr )
if lE == cystka and md then
local cystka = createVehicle ( getVehicleModelFromName ( "Dune" ), cysterny [ n ][ 1 ], cysterny [ n ][ 2 ], cysterny [ n ][ 3 ], cysterny [ n ][ 4 ], cysterny [ n ][ 5 ], cysterny [ n ][ 6 ])
end
end
addEventHandler ( "onMarkerLeave" , markerek , wyjscie )
addEventHandler ( "onMarkerHit" , napelnianie , function( hitElement , md )
if hitElement == cystka and getElementData ( cystka , "zatankowana" ) ~= true and md then
setElementData ( cystka , "zatankowana" , true )
triggerClientEvent ( root , "start" , root )
setElementVisibleTo ( blipek , root , false )
setElementVisibleTo ( napelnianie , root , false )
end
end )
addEvent ( "pokazStuff" , true )
addEventHandler ( "pokazStuff" , getRootElement (), function()
setElementVisibleTo ( blipek , root , true )
setElementVisibleTo ( napelnianie , root , true )
end )
CLIENTSIDE
local punktPaliwa = {
{ 251.6298828125 , 1444.447265625 , 10.5859375 },
{ 249.7373046875 , 1420.27734375 , 10.549697875977 },
{ 250.15625 , 1395.7998046875 , 10.5859375 },
{ 248.2568359375 , 1371.349609375 , 10.5859375 },
}
local stacje = {
{ 1380.78564 , 456.15646 , 19.87974 },
{ 2117.19263 , 931.19733 , 10.82031 },
}
local stacyjka = createMarker ( 0 , 0 , 0 , "corona" , 8 , 0 , 100 , 255 , 0 )
addEvent ( "start" , true )
addEventHandler ( "start" , getRootElement (), function()
local pos = stacje [ math . random ( 1 , #stacje)]
setElementPosition ( stacyjka , pos [ 1 ], pos [ 2 ], pos [ 3 ])
setElementAlpha ( stacyjka , 255 )
createBlipAttachedTo ( stacyjka , 12 )
end )
addEventHandler ( "onClientMarkerHit" , stacyjka , function( hitElement , md )
if getElementData ( hitElement , "zatankowana" ) == true and md then
local hajsik = math . random ( 50 , 85 )
outputChatBox ( "Dowioz?e? paliwo, dostajesz za to " .. hajsik .. " dolar?w." )
givePlayerMoney ( hajsik )
triggerServerEvent ( "pokazStuff" , resourceRoot )
end
end )
Tak wiem, zapewne wszystko zrobione na opak, po mojemu
Za wskazanie b??du, ewentualnie powiedzenie co mo?na poprawi?, ?eby skrypt nie by? ca?y na opak stawiam zimne piwko i repke
Wysłany: 2018-01-30, 21:10
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Ostatnio zmieniony przez Barcioo 2018-01-30, 21:37, w całości zmieniany 2 razy
Więcej szczegółów
Wystawiono 1 piw(a):CjPomarancza
Wysłany: 2018-01-30, 21:21
CjPomarancza
:-)
Wiek: 17 Na forum: 3183 dni Posty: 90
Piwa : 12
"Barcioo" napisał/a :
triggerClientEvent ( hitElement , "start" , root , cystka )
Pewny nie jestem
W og?le si? przesta?o triggerowa?. No bo przecie? co da striggerowanie eventu dla pojazdu?
[ Dodano : 2018-01-31, 19:16 ]
Kto? co??
[ Dodano : 2018-01-31, 19:44 ]
Mo?na zamkn??, poradzi?em sobie. Rozwi?zanie:
addEventHandler ( "onClientMarkerHit" , stacyjka , function( hitPlayer , md )
if getElementData ( getPedOccupiedVehicle ( hitPlayer ), "zatankowana" ) == true and md then
Tagi: przy :: uderzeniu :: marker :: funkcja :: trigger :: się :: nie :: wykonuje.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: