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

Wysłany: 2017-02-27, 21:01


Krzemo1234







Wiek: 26
Na forum: 3751 dni
Posty: 387
Nick w MP: Krzemo

Piwa: 16

Respekt: 40

createBlip(-1624.73690.997.1930,2,0,0,0,0,0,275) 

function getPointFrontOfElement(element,distance) 
if not element then return end 

local xygetElementPosition element local rxryrz getElementRotation element + (distance * (math.sin(math.rad(-rz))) ) 
+ (distance * (math.cos(math.rad(-rz))) ) 
return x,y,z 
end 

function getPositionFromElementAtOffset(element,x,y,z) 
if not element then return end 
if not x or not y or not z then 
return xyz 
end 
local matrix getElementMatrix element local offX matrix[1][1] + matrix[2][1] + matrix[3][1] + matrix[4][1local offY matrix[1][2] + matrix[2][2] + matrix[3][2] + matrix[4][2local offZ matrix[1][3] + matrix[2][3] + matrix[3][3] + matrix[4][3] 
return offXoffYoffZ 
end 

function getVehicleWheelPosition(vehicle,wheellocal xy000 
local minXminYminZmaxXmaxYmaxZ getElementBoundingBox(vehicle) 
if wheel == 1 then 
xygetPositionFromElementAtOffset(vehicleminXmaxYminZ) 
elseif wheel == 2 then 
xygetPositionFromElementAtOffset(vehicleminX, -maxYminZ)    
elseif wheel == 3 then 
xygetPositionFromElementAtOffset(vehiclemaxXmaxYminZ) 
elseif wheel == 4 then 
xygetPositionFromElementAtOffset(vehiclemaxX, -maxYminZend    
return xyz 
end 

function onClientRender() 
if isPedInVehicle(localPlayerthen    
local vehicle getPedOccupiedVehicle(localPlayer) 
if not vehicle then return end 

local stinger getElementsByType("object") 

--local wx0wy0wz0 getVehicleWheelPosition(vehicle,0local wx1wy1wz1 getVehicleWheelPosition(vehicle,1local wx2wy2wz2 getVehicleWheelPosition(vehicle,2local wx3wy3wz3 getVehicleWheelPosition(vehicle,3local wx4wy4wz4 getVehicleWheelPosition(vehicle,4) 

-- for visual debug wheel positions 
--dxDrawLine3D(wx1wy1wz1wx2wy2wz2tocolor(0,255,0)) 
--dxDrawLine3D(wx3wy3wz3wx4wy4wz4tocolor(0,255,0)) 

for kv in pairs(stinger) do 
if getElementData(v,"isStinger") == true then 
local vxvyvz getElementPosition(v) 
if getDistanceBetweenPoints3D(wx1wy1wz1vxvyvz) <= 2.0 then 
setVehicleWheelStates(vehicle1, -1, -1, -1)    
end 
if getDistanceBetweenPoints3D(wx2wy2wz2vxvyvz) <= 2.0 then 
setVehicleWheelStates(vehicle, -11, -1, -1)    
end 
if getDistanceBetweenPoints3D(wx3wy3wz3vxvyvz) <= 2.0 then 
setVehicleWheelStates(vehicle, -1, -11, -1)    
end 
if getDistanceBetweenPoints3D(wx4wy4wz4vxvyvz) <= 2.0 then 
setVehicleWheelStates(vehicle, -1, -1, -11)    
end    
end    
end 
end 
end 
addEventHandler("onClientRender",getRootElement(), onClientRender) 

function onCreateStinger(xyz) 
if(getDistanceBetweenPoints3D(xyzgetElementPosition(localPlayer)) <= 10 then 
local sound playSound3D("plant.wav"xyzsetSoundMaxDistance(sound10end 
end 
addEvent("onCreateStinger"trueaddEventHandler("onCreateStinger"getRootElement(), onCreateStinger)


Je?li kto? m?g?by pom?c poprawi? skrypt przez niego s? straszne lagi na serwerze fps spadaj? o 20

Za pomoc stawiam zimne :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-27, 21:24


Brzysiek

Skrypter pralek






Wiek: 27
Na forum: 5198 dni
Posty: 488
Nick w MP: Brzysiek

Piwa: 1034

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360

Zamie?

local stinger getElementsByType("object")

na

local stinger getElementsByType("object"resourceRoot


Skrypt wykonywa? co klatk? p?tle na wszystkie obiekty na serwerze - to boli ;) . Mo?na to ograniczy? do obiekt?w, kt?re powsta?y tylko w zasobie z kt?rego skrypt jest odpalany (czyli zapewne b?d? to same obiekty kolczatek)

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Krzemo1234
Wysłany: 2017-02-27, 23:03


Krzemo1234







Wiek: 26
Na forum: 3751 dni
Posty: 387
Nick w MP: Krzemo

Piwa: 16

Respekt: 40

Dzi?kuje ci bardzo masz piwo

[ Dodano: 2017-02-27, 23:08 ]
Do zamkni?cia

Podpis
Jeśli ci pomogłem zostaw zimne :piwo:
Postaw piwo autorowi tego posta
 

 
Tagi: straszne :: lagi :: jest :: nie :: tak
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Straszne lagi co jest nie tak ? 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