Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

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

Respekt: 22

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

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-12, 10:20


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64

W paczce ogrpg jest ogrpg-fotoradary tam s? kordy i ograniczenia bodajze nie chodzi o mandaty ale auto samoistnie w tamtych terenach zwalnia

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-12, 15:41


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3810 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240

Chyba powiniene? to napisa? w dziale SZUKAM SKRYPTU.
Ale masz tu m?j kod


function getElementSpeed(theElementunit)
    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) == or tonumber(unit) == 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 or ((not tonumber(unit)) and unit or tonumber(unit))
    local mult = (unit == or unit == "m/s") and 50 or ((unit == 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,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)


Postaw piwo autorowi tego posta
 

 
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

Respekt: 22


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

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-12, 18:40


Cjalis







Wiek: 35
Na forum: 3543 dni
Posty: 26
Nick w MP: Cejot

Piwa: 36

Respekt: 70


local strefy = {
    {1336.23840656.788769.8562460.50634765625146.8001098632816.164074325562 },
    {924.076901661.905769.25354194.91711425781138.3175048828123.899999046326},
    {2197.997802405.43872, -31.81085178.1982421875112.389648437557.499998474121},
}
 
local ogranicznik createElement ("ogranicznik");
for i,v in ipairs strefy  ) do
     strefa[i] = createColCuboid ], ], ], ], ], ], [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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-12, 19:05


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3810 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240

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(theElementunit)
    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) == or tonumber(unit) == 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 or ((not tonumber(unit)) and unit or tonumber(unit))
    local mult = (unit == or unit == "m/s") and 50 or ((unit == or unit == "km/h") and 180 or 111.84681456)
    return (Vector3(getElementVelocity(theElement)) * mult).length
end -- kod na pobrane predkosci
function setElementSpeed(elementunitspeed)
    if (unit == nilthen unit 0 end
    if (speed == nilthen speed 0 end
    speed tonumber(speed)
    local acSpeed getElementSpeed(elementunit)
    if (acSpeed~=falsethen -- if true element is validno 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,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,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)


Postaw piwo autorowi tego posta
 

 
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

Respekt: 22

dzi?ki dzia?a mo?na zamkn??

Postaw piwo autorowi tego posta
 

 
Tagi: prędkości
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » prędkości Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku