Wysłany: 2017-02-20, 14:53
mixLoLmix2
Programista
Wiek: 35 Na forum: 4113 dni Posty: 454
Nick w MP: TomeQmix
Piwa : 1915
Mam ma?e pytanko jak zrobi? ?e jak pr?dko?? b?dzie wysza ni? np. 60 to Wykona si? co? co ja sobie ustawie
Kod na suszarke:
local sw , sh = guiGetScreenSize ()
function onSuszarka ( target )
if target then
if getElementType ( target ) == "vehicle" then
vehicle = target
end
end
end
addEventHandler ( "onClientPlayerTarget" , getRootElement (), onSuszarka )
function wlaczLPM ()
render = true
end
bindKey ( "mouse1" , "down" , wlaczLPM )
function wylaczLPM ()
render = false
end
bindKey ( "mouse1" , "up" , wylaczLPM )
function dxDrawSuszarkaInfo ()
if render then
if vehicle then
if isElement ( vehicle ) then
if getPedWeapon ( localPlayer ) == 22 then
local controller = getVehicleController ( vehicle )
if controller then
--if controller ~= localPlayer then
if getElementType ( controller ) == "player" then
local x , y , z = getElementPosition ( localPlayer )
local tx , ty , tz = getElementPosition ( controller )
local dis = getDistanceBetweenPoints3D ( x , y , z , tx , ty , tz )
local id = getElementData ( vehicle , "car_id" ) or "brak"
local wl = getElementData ( vehicle , "car_owner" ) or "brak"
if 80 >= dis then -- jestesmy dosyc blisko gracza
local kmh = getVehicleSpeed ( vehicle )
dxDrawRectangle ( 1115 / 1440 * sw , 401 / 900 * sh , 290 / 1440 * sw , 219 / 900 * sh , tocolor ( 0 , 66 , 25 , 206 ), false )
dxDrawRectangle ( 1106 / 1440 * sw , 382 / 900 * sh , 309 / 1440 * sw , 19 / 900 * sh , tocolor ( 25 , 119 , 0 , 217 ), false )
dxDrawText ( "Suszarka Policji" , 1106 / 1440 * sw , 372 / 900 * sh , 1415 / 1440 * sw , 390 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 3.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Pr?dko??: <" .. kmh .. " km/h>" , 1122 / 1440 * sw , 411 / 900 * sh , 1420 / 1440 * sw , 429 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "center" , false , false , false , false , false )
dxDrawText ( "W?a??iciel: <" .. wl .. ">" , 1122 / 1440 * sw , 443 / 900 * sh , 1420 / 1440 * sw , 461 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "center" , false , false , false , false , false )
dxDrawText ( "Pojazd: <" .. getVehicleName ( vehicle ).. ">" , 1122 / 1440 * sw , 483 / 900 * sh , 1420 / 1440 * sw , 501 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "center" , false , false , false , false , false )
dxDrawText ( "Nick Oraz ID Gracza: <" .. getElementData ( controller , "id" ).. "> / <" .. getPlayerName ( controller ).. ">" , 1122 / 1440 * sw , 528 / 900 * sh , 1420 / 1440 * sw , 547 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
dxDrawText ( "ID Pojazdu: " .. id .. "" , 1122 / 1440 * sw , 557 / 900 * sh , 1420 / 1440 * sw , 576 / 900 * sh , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
end
end
-- end
end
end
-- end
end
end
end
if ( getKeyState ( "mouse1" ) == false ) then -- dodatkowa blokada
wylaczLPM ()
end
end
addEventHandler ( "onClientRender" , getRootElement (), dxDrawSuszarkaInfo )
function getVehicleSpeed ( element )
local vx , vy , vz = getElementVelocity ( element )
local speed = math . sqrt ( vx ^ 2 + vy ^ 2 + vz ^ 2 ) * 161
return math . floor ( speed )
end
Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Wysłany: 2017-02-20, 15:07
Hemoglobina
Tylko Hema
Wiek: 29 Na forum: 3397 dni Posty: 89
Nick w MP: Answer
Piwa : 1386
if kmh >= 60 then
bla
bla
bla
end
Tylko
local kmh = getVehicleSpeed ( vehicle )
Wyrzu? poza funkcje
function dxDrawSuszarkaInfo ()
Chyba, ?e zamierzasz robi? to w?a?nie w tej funkcji.
Wysłany: 2017-02-20, 15:18
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Hemoglobina , Co ty piszesz?
mathSpeed =( vx ^ 2 + vy ^ 2 + vz ^ 2 )^ 0.5 * 1.8 * 100
if mathSpeed > 60 then
-- tutaj funckja
end
a je?eli chcesz ?eby najpierw by? napis na bia?o a gdy si? przkroczy pr?dko?? to na czarwono:
dxDrawText ( " " .. mathSpeed .. " KM" , 710 , 375 , 996 , 410 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
if mathSpeed > 60 then
dxDrawText ( " " .. mathSpeed .. " KM" , 710 , 375 , 996 , 410 , tocolor ( 178 , 34 , 34 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
else
dxDrawText ( " " .. mathSpeed .. " KM" , 710 , 375 , 996 , 410 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
end
Podpis
"amited" napisał/a :
Wysłany: 2017-02-20, 15:30
Hemoglobina
Tylko Hema
Wiek: 29 Na forum: 3397 dni Posty: 89
Nick w MP: Answer
Piwa : 1386
"amited" napisał/a :Hemoglobina , Co ty piszesz?
mathSpeed =( vx ^ 2 + vy ^ 2 + vz ^ 2 )^ 0.5 * 1.8 * 100
if mathSpeed > 60 then
-- tutaj funckja
end
a je?eli chcesz ?eby najpierw by? napis na bia?o a gdy si? przkroczy pr?dko?? to na czarwono:
dxDrawText ( " " .. mathSpeed .. " KM" , 710 , 375 , 996 , 410 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
if mathSpeed > 60 then
dxDrawText ( " " .. mathSpeed .. " KM" , 710 , 375 , 996 , 410 , tocolor ( 178 , 34 , 34 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
else
dxDrawText ( " " .. mathSpeed .. " KM" , 710 , 375 , 996 , 410 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
end
Przecie? w tym skrypcie co poda? jest praktycznie to samo.
Zamiast mathSpeed jest kmh
function getVehicleSpeed ( element )
local vx , vy , vz = getElementVelocity ( element )
local speed = math . sqrt ( vx ^ 2 + vy ^ 2 + vz ^ 2 ) * 161
return math . floor ( speed )
end
local kmh = getVehicleSpeed ( vehicle )
Wysłany: 2017-02-20, 15:33
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Hemoglobina , Aha sorry xd Widzia?em tylko pocz?tek "Suszarka policji" to wiedzia?em ?e on to wzi?? z ogrpg, a tam jest to co ja napisa?em.
Podpis
"amited" napisał/a :
Tagi: suszaka
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: