Wysłany: 2016-11-11, 22:37
killercycDDS
Migacz
Wiek: 25 Na forum: 4512 dni Posty: 629
Nick w MP: killer_cyc[DDS]
Piwa : 1659
Witam czy jest gdzie? na necie skrypt w kt?rym dodajemy odpowiednie kordynacje x y z i mamy np ograniczenie pr?dko?? do 50. nie chodzi mi tu o tempomat
Wysłany: 2016-11-12, 10:20
PapaSmerf
Wiek: 25 Na forum: 3526 dni Posty: 237
Piwa : 3857
W paczce ogrpg jest ogrpg-fotoradary tam s? kordy i ograniczenia bodajze nie chodzi o mandaty ale auto samoistnie w tamtych terenach zwalnia
Wysłany: 2016-11-12, 15:41
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3810 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
Chyba powiniene? to napisa? w dziale SZUKAM SKRYPTU.
Ale masz tu m?j kod
function getElementSpeed ( theElement , unit )
assert ( isElement ( theElement ), "Bad argument 1 @ getElementSpeed (element expected, got " .. type ( theElement ) .. ")" )
assert ( getElementType ( theElement ) == "player" or getElementType ( theElement ) == "ped" or getElementType ( theElement ) == "object" or getElementType ( theElement ) == "vehicle" , "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType ( theElement ) .. ")" )
assert (( unit == nil or type ( unit ) == "string" or type ( unit ) == "number" ) and ( unit == nil or ( tonumber ( unit ) and ( tonumber ( unit ) == 0 or tonumber ( unit ) == 1 or tonumber ( unit ) == 2 )) or unit == "m/s" or unit == "km/h" or unit == "mph" ), "Bad argument 2 @ getElementSpeed (invalid speed unit)" )
unit = unit == nil and 0 or (( not tonumber ( unit )) and unit or tonumber ( unit ))
local mult = ( unit == 0 or unit == "m/s" ) and 50 or (( unit == 1 or unit == "km/h" ) and 180 or 111.84681456 )
return ( Vector3 ( getElementVelocity ( theElement )) * mult ). length
end -- kod na pobrane predkosci
local shape = createColSphere (- 721.39916992188 , 961.87664794922 , 12.158950805664 , 100 ) -- tworzenie miejsca ( pierwsze 3 argumenty to koordynaty x , y , z , a ostatni to zasieg )
setElementData ( shape , "maxpredkosc" , 100 ) -- ustalanie maxymalnej predkosci w miejscu
setTimer (function()
for k , v in ipairs ( getElementsWithinColShape ( shape , "vehicle" ) ) do -- pobieranie samochod ? w w miejscu
if getElementSpeed ( v , 1 )> getElementData ( shape , "maxpredkosc" ) then
outputChatBox ( "Przekroczyles predkosc!" , getVehicleOccupant ( v ))
end
end
end , 100 , 0 )
Wysłany: 2016-11-12, 18:14
killercycDDS
Migacz
Wiek: 25 Na forum: 4512 dni Posty: 629
Nick w MP: killer_cyc[DDS]
Piwa : 1659
function? getElementSpeed ( theElement ,? unit )
???? assert ( isElement ( theElement ),? "Bad?argument?1?@?getElementSpeed?(element?expected,?got?" ?..? type ( theElement )?..? ")" )
???? assert ( getElementType ( theElement )?==? "player" ?or? getElementType ( theElement )?==? "ped" ?or? getElementType ( theElement )?==? "object" ?or? getElementType ( theElement )?==? "vehicle" ,? "Invalid?element?type?@?getElementSpeed?(player/ped/object/vehicle?expected,?got?" ?..? getElementType ( theElement )?..? ")" )
???? assert (( unit ?==? nil ?or? type ( unit )?==? "string" ?or? type ( unit )?==? "number" )?and?( unit ?==? nil ?or?( tonumber ( unit )?and?( tonumber ( unit )?==? 0 ?or? tonumber ( unit )?==? 1 ?or? tonumber ( unit )?==? 2 ))?or? unit ?==? "m/s" ?or? unit ?==? "km/h" ?or? unit ?==? "mph" ),? "Bad?argument?2?@?getElementSpeed?(invalid?speed?unit)" )
???? unit ?=? unit ?==? nil ?and? 0 ?or?(( not ? tonumber ( unit ))?and? unit ?or? tonumber ( unit ))
???? local ? mult ?=?( unit ?==? 0 ?or? unit ?==? "m/s" )?and? 50 ?or?(( unit ?==? 1 ?or? unit ?==? "km/h" )?and? 180 ?or? 111.84681456 )
????return?( Vector3 ( getElementVelocity ( theElement ))?*? mult ). length
end ?--? kod ? na ? pobrane ? predkosci
local ? shape = createColSphere (- 721.39916992188 , 961.87664794922 , 12.158950805664 , 100 )?--? tworzenie ? miejsca ?( pierwsze ? 3 ? argumenty ? to ? koordynaty ? x , y , z ?,? a ? ostatni ? to ? zasieg )
setElementData ( shape , "maxpredkosc" , 100 )?-- ustalanie ? maxymalnej ? predkosci ? w ? miejscu
setTimer (function()
for? k , v ? in ? ipairs ?( getElementsWithinColShape ?( shape , "vehicle" ?)?)?do?--? pobieranie ? samochod ? w ? w ? miejscu
if? getElementSpeed ( v , 1 )> getElementData ( shape , "maxpredkosc" )? then
outputChatBox ( "Przekroczyles?predkosc!" , getVehicleOccupant ( v ))
end
end
end , 100 , 0 )
Chodzi?o mi oto ?e gdy jad? przez dan? stref? nie da si? przekroczy? np 40 km/h mo?na jecha? wolniej ale nie szybko
Wysłany: 2016-11-12, 18:40
Cjalis
Wiek: 35 Na forum: 3543 dni Posty: 26
Nick w MP: Cejot
Piwa : 36
local strefy = {
{ 1336.23840 , 656.78876 , 9.85624 , 60.50634765625 , 146.80010986328 , 16.164074325562 },
{ 924.07690 , 1661.90576 , 9.25354 , 194.91711425781 , 138.31750488281 , 23.899999046326 },
{ 2197.99780 , 2405.43872 , - 31.81085 , 178.1982421875 , 112.3896484375 , 57.499998474121 },
}
local ogranicznik = createElement ( "ogranicznik" );
for i , v in ipairs ( strefy ) do
strefa [ i ] = createColCuboid ( v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [ 7 ] )
setElementParent ( strefa [ i ], ogranicznik );
end
addEventHandler ( "onColShapeHit" , ogranicznik , function( el , md )
if getElementType ( el )== "vehicle" then
setElementData ( el , "vehicle:tempspeed" , 50 )
end
end )
addEventHandler ( "onColShapeLeave" , ogranicznik , function( el , md )
if getElementType ( el )== "vehicle" then
removeElementData ( el , "vehicle:tempspeed" )
end
end )
Wysłany: 2016-11-12, 19:05
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3810 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
Cjalis tw?j skrypt , je?li si? nie myl? ustawia jedynie data pojazdu,a inny ogranicza pr?dko??.
A oto m?j poprawiony kod
function getElementSpeed ( theElement , unit )
assert ( isElement ( theElement ), "Bad argument 1 @ getElementSpeed (element expected, got " .. type ( theElement ) .. ")" )
assert ( getElementType ( theElement ) == "player" or getElementType ( theElement ) == "ped" or getElementType ( theElement ) == "object" or getElementType ( theElement ) == "vehicle" , "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType ( theElement ) .. ")" )
assert (( unit == nil or type ( unit ) == "string" or type ( unit ) == "number" ) and ( unit == nil or ( tonumber ( unit ) and ( tonumber ( unit ) == 0 or tonumber ( unit ) == 1 or tonumber ( unit ) == 2 )) or unit == "m/s" or unit == "km/h" or unit == "mph" ), "Bad argument 2 @ getElementSpeed (invalid speed unit)" )
unit = unit == nil and 0 or (( not tonumber ( unit )) and unit or tonumber ( unit ))
local mult = ( unit == 0 or unit == "m/s" ) and 50 or (( unit == 1 or unit == "km/h" ) and 180 or 111.84681456 )
return ( Vector3 ( getElementVelocity ( theElement )) * mult ). length
end -- kod na pobrane predkosci
function setElementSpeed ( element , unit , speed )
if ( unit == nil ) then unit = 0 end
if ( speed == nil ) then speed = 0 end
speed = tonumber ( speed )
local acSpeed = getElementSpeed ( element , unit )
if ( acSpeed ~= false ) then -- if true - element is valid , no need to check again
local diff = speed / acSpeed
if diff ~= diff then return end -- if the number is a 'NaN' return end .
local x , y , z = getElementVelocity ( element )
setElementVelocity ( element , x * diff , y * diff , z * diff )
return true
end
return false
end -- kod na ustawienie predkosci
local shape = createColSphere (- 721.39916992188 , 961.87664794922 , 12.158950805664 , 100 ) -- tworzenie miejsca ( pierwsze 3 argumenty to koordynaty x , y , z , a ostatni to zasieg )
setElementData ( shape , "maxpredkosc" , 20 ) -- ustalanie maxymalnej predkosci w miejscu
setTimer (function()
for k , v in ipairs ( getElementsWithinColShape ( shape , "vehicle" ) ) do -- pobieranie samochod ? w w miejscu
if getElementSpeed ( v , 1 )> getElementData ( shape , "maxpredkosc" ) then
setElementSpeed ( v , 1 , getElementData ( shape , "maxpredkosc" )- 5 )-- ustawiamy predkosc na max predkosc w danej sferze .
end
end
end , 50 , 0 )
Wysłany: 2016-11-12, 20:02
killercycDDS
Migacz
Wiek: 25 Na forum: 4512 dni Posty: 629
Nick w MP: killer_cyc[DDS]
Piwa : 1659
dzi?ki dzia?a mo?na zamkn??
Tagi: prędkości
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: