Wysłany: 2017-12-28, 12:00
BartiCoderNoob
Wiek: 28 Na forum: 3080 dni Posty: 11
Nick w MP: Barti
Mam ambicj? napisa? wszystkie misje z GTA SA na server MTA dla dw?ch os?b, ale nie za bardzo jeszcze umiem pisa? skrypty.
To co uda?o mi si? napisa?, to ?e po wej?ciu na server, pojawia si? rower [tam gdzie pierwsza misja w SA]. Teraz chcia?em ?eby do roweru by? doczepiony marker a po wej?ciu na rower, marker znikn??. Oto moje wypociny, kt?re absolutnie nie dzia?aj?.
M?g?by mi kto? co? podpowiedzie??
local x1 , y1 , z1 , rx1 , ry1 , rz1 = 2243.2 , - 1263.2 , 23.5 , 0 , 0 , 270
function startBikes ()
local Bike = createVehicle ( 481 , 0 , 0 , 0 )
setVehicleColor ( Bike , 88 , 142 , 110 )
spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
local spawnVeh = spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
end
addEventHandler ( "onPlayerJoin" , getRootElement (), startBikes )
function createMarkerAttachedTo ( element , mType , size , r , g , b , a , visibleTo , xOffset , yOffset , zOffset )
mType , size , r , g , b , a , visibleTo , xOffset , yOffset , zOffset = "arrow" , 0 , 5 , 0 , 0 , 255 , 255 , getRootElement (), 0 , 0 , 1
assert ( isElement ( element ), "Bad argument @ 'createMarkerAttachedTo' [Expected element at argument 1, got " .. type ( element ) .. "]" ) assert ( type ( mType ) == "string" , "Bad argument @ 'createMarkerAttachedTo' [Expected string at argument 2, got " .. type ( mType ) .. "]" ) assert ( type ( size ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 3, got " .. type ( size ) .. "]" ) assert ( type ( r ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 4, got " .. type ( r ) .. "]" ) assert ( type ( g ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 5, got " .. type ( g ) .. "]" ) assert ( type ( b ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 6, got " .. type ( b ) .. "]" ) assert ( type ( a ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 7, got " .. type ( a ) .. "]" ) assert ( isElement ( visibleTo ), "Bad argument @ 'createMarkerAttachedTo' [Expected element at argument 8, got " .. type ( visibleTo ) .. "]" ) assert ( type ( xOffset ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 9, got " .. type ( xOffset ) .. "]" ) assert ( type ( yOffset ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 10, got " .. type ( yOffset ) .. "]" ) assert ( type ( zOffset ) == "number" , "Bad argument @ 'createMarkerAttachedTo' [Expected number at argument 11, got " .. type ( zOffset ) .. "]" )
local m = createMarker ( 0 , 0 , 0 , mType , size , r , g , b , a , visibleTo )
if m then if attachElements ( m , element ) then return m end end return false
end
addEventHandler ( "onPlayerJoin" , getRootElement (), createMarkerAttachedTo )
local Bike1 = { [ 481 ]= true }
function deleteMarker ( theVehicle , seat , jacked )
local vehID = getElemendModel ( Bike1 )
if Bike1 [ vehID ] then
outputChatBox ( "Go to the Grove Street!" , source )
end
end
addEventHandler ( "onPlayerEnterVehicle" , getRootElement (), deleteMarker )
Wysłany: 2017-12-28, 13:49
koxpl2x22
MAPPER-ALLEREK
Wiek: 23 Na forum: 4556 dni Posty: 375
Nick w MP: ALLEREK
Piwa : 1726
Po 1. Pisz misje po client-side(z triggerowaniem do serverside by zsynchronizowa? dw?ch graczy)
Po 2.
Wysłany: 2017-12-28, 13:51
BartiCoderNoob
Wiek: 28 Na forum: 3080 dni Posty: 11
Nick w MP: Barti
Czyta?em wiki, ale to wszystko co potrafi?em z niej wycisn??. Prze?o?? to na client-side, zobaczymy
Wysłany: 2017-12-28, 13:55
koxpl2x22
MAPPER-ALLEREK
Wiek: 23 Na forum: 4556 dni Posty: 375
Nick w MP: ALLEREK
Piwa : 1726
"BartiCoderNoob" napisał/a :Czyta?em wiki, ale to wszystko co potrafi?em z niej wycisn??. Prze?o?? to na client-side, zobaczymy
polecam ci robi? eventHandlery w taki spos?b
local x1 , y1 , z1 , rx1 , ry1 , rz1 = 2243.2 , - 1263.2 , 23.5 , 0 , 0 , 270
addEventHandler ( "onPlayerJoin" , getRootElement (),function()
local Bike = createVehicle ( 481 , 0 , 0 , 0 )
setVehicleColor ( Bike , 88 , 142 , 110 )
spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
local spawnVeh = spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
end )
Tak robi WI?KSZO?? os?b robi?cych skrypty, jest to wygodne i czytelne.
Wysłany: 2017-12-28, 17:35
BartiCoderNoob
Wiek: 28 Na forum: 3080 dni Posty: 11
Nick w MP: Barti
Dobra, troch? przerobi?em, ale niszczenie markera nadal nie dzia?a:
local x1 , y1 , z1 , rx1 , ry1 , rz1 = 2243.2 , - 1263.2 , 23.5 , 0 , 0 , 270 -- ustawiam koordynaty spawnu pojazdu
addEventHandler ( "onPlayerJoin" , getRootElement (),function()
local Bike = createVehicle ( 481 , 0 , 0 , 0 ) -- ustawiam rodzaj pojazdu
setVehicleColor ( Bike , 88 , 142 , 110 ) -- ustawiam kolor
spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
local spawnVeh = spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 ) -- spawnuje pojazd
local xb1 , yb1 , zb1 = getElementPosition ( Bike ) -- bior ? koordynaty pojazdu
local theMarker = createMarker ( xb1 , yb1 , zb1 , "arrow" , 0.4 , 255 , 255 , 0 , 170 ) -- tworz ? nad pojazdem marker
attachElements ( theMarker , Bike , 0 , 0 , 1.5 ) -- kt ? ry jest do niego przyczepiony
local driver = getVehicleOccupant ( Bike ) -- chcia ? em odczyta ? czy na rowerze kto ? siedzi
if ( driver ) then -- i je ? li siedzi
destroyElement ( element theMarker ) -- to zniszczy ? marker
end
end )
Wysłany: 2017-12-28, 19:04
koxpl2x22
MAPPER-ALLEREK
Wiek: 23 Na forum: 4556 dni Posty: 375
Nick w MP: ALLEREK
Piwa : 1726
"BartiCoderNoob" napisał/a :Dobra, troch? przerobi?em, ale niszczenie markera nadal nie dzia?a:
local x1 , y1 , z1 , rx1 , ry1 , rz1 = 2243.2 , - 1263.2 , 23.5 , 0 , 0 , 270 -- ustawiam koordynaty spawnu pojazdu
addEventHandler ( "onPlayerJoin" , getRootElement (),function()
local Bike = createVehicle ( 481 , 0 , 0 , 0 ) -- ustawiam rodzaj pojazdu
setVehicleColor ( Bike , 88 , 142 , 110 ) -- ustawiam kolor
spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
local spawnVeh = spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 ) -- spawnuje pojazd
local xb1 , yb1 , zb1 = getElementPosition ( Bike ) -- bior ? koordynaty pojazdu
local theMarker = createMarker ( xb1 , yb1 , zb1 , "arrow" , 0.4 , 255 , 255 , 0 , 170 ) -- tworz ? nad pojazdem marker
attachElements ( theMarker , Bike , 0 , 0 , 1.5 ) -- kt ? ry jest do niego przyczepiony
local driver = getVehicleOccupant ( Bike ) -- chcia ? em odczyta ? czy na rowerze kto ? siedzi
if ( driver ) then -- i je ? li siedzi
destroyElement ( element theMarker ) -- to zniszczy ? marker
end
end )
destroyElement(theMarker) -- to zniszczy? marker
polecam ci nazywa? markery wed?ug tego co robi? itd.
czyli np marker nad rowerem to by?by
local mrower
Wysłany: 2017-12-28, 22:54
BartiCoderNoob
Wiek: 28 Na forum: 3080 dni Posty: 11
Nick w MP: Barti
MAM TO!!!
local x1 , y1 , z1 , rx1 , ry1 , rz1 = 2243.2 , - 1263.2 , 23.5 , 0 , 0 , 270
addEventHandler ( "onPlayerJoin" , getRootElement (),
function()
getElementPosition ( source , x1 , y1 , z1 )
Bike = createVehicle ( 481 , 0 , 0 , 0 )
setVehicleColor ( Bike , 88 , 142 , 110 )
spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
local spawnVeh = spawnVehicle ( Bike , x1 , y1 , z1 , rx1 , ry1 , rz1 )
local xb1 , yb1 , zb1 = getElementPosition ( Bike )
mBike1 = createMarker ( xb1 , yb1 , zb1 , "arrow" , 0.4 , 255 , 255 , 0 , 170 )
attachElements ( mBike1 , Bike , 0 , 0 , 1.5 )
local driver = getVehicleOccupant ( Bike )
end )
addEventHandler ( "onVehicleEnter" , root ,
function ( player )
if ( source == Bike ) then
destroyElement ( mBike1 )
end
end )
Tagi: niszczenie :: markerka :: wejściu :: pojazdu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: