LoloV16
Wiek: 25 Na forum: 2933 dni Posty: 19
Nick w MP: LoloV16
Piwa : 4
Witam, mam pytanie. Czy kto? wie w jaki spos?b mog? z edytowa? ten skrypt na wideorejestrator by by? on dostepny po przez komend? dla ka?dego gracza lub te? osoby dodanej do grupy ACL ,,Policja''
Dane skryptu :
--if getPlayerName ( localPlayer )~= "Anonimowy" and getPlayerName ( localPlayer )~= "ZmK" then
-- return
-- end
local sx , sy = guiGetScreenSize ()
local czc = exports . czcionka : CZ9 ()
local wlaczony = false
function isPlayerInACL ( player , acl )
local accountName = getAccountName ( getPlayerAccount ( player ) )
if accountName ~= "guest" and type ( aclGetGroup ( acl ) ) == "userdata" then
return isObjectInACLGroup ( "user." .. accountName , aclGetGroup ( acl ) )
end
return false
end
)
function checkAccess ( thePlayer )
if isPlayerInACL ( thePlayer , "Console" ) then
outputChatBox ( "Access Granted!" )
else
outputChatBox ( "Access Denied!" )
end
end
addCommandHandler ( "myaccess" , checkAccess )
function findRotation ( x1 , y1 , x2 , y2 )
local t = - math . deg ( math . atan2 ( x2 - x1 , y2 - y1 ) )
return t < 0 and t + 360 or t
end
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
local recX , recY , recX2 , recY2 = sx / 2 - 200 , sy - 200 , 400 , 300
)
local dxdraw =(
function()
local veh = getPedOccupiedVehicle ( localPlayer )
if not veh then
return
end
if not isPolicjant ( localPlayer ) then
return
end
--if ( getElementModel ( veh )~= 597 ) and ( getElementModel ( veh )~= 597 ) and ( getElementModel ( veh )~= 598 ) then
-- return
-- end
if not isPojazdPolicji ( veh ) then
return
end
if ( getPedOccupiedVehicleSeat ( localPlayer )~= 0 ) and ( getPedOccupiedVehicleSeat ( localPlayer )~= 1 ) then
return
end
local x , y , z = getElementPosition ( veh )
local z_poj = nil
local tbl ={}
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if ( v ~= veh ) then
local px , py , pz = getElementPosition ( v )
if ( getDistanceBetweenPoints3D ( x , y , z , px , py , pz )<= 80 ) then -- odleg ? o ?? ? apania na wideo
local rotBetween = findRotation ( x , y , px , py )
local _ , _ , rot = getElementRotation ( veh )
local different =( rotBetween - rot )
different = math . abs ( different )
if ( different <= 10 ) then
table . insert ( tbl , v )
end
end
end
end
if ( #tbl==1) then
z_poj = tbl [ 1 ]
else
if ( #tbl>0) then
z_poj = tbl [ 1 ]
local x3 , y3 , z3 = getElementPosition ( z_poj )
for i , v in ipairs ( tbl ) do
local x2 , y2 , z2 = getElementPosition ( v )
if ( getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )< getDistanceBetweenPoints3D ( x , y , z , x3 , y3 , z3 )) then
z_poj = v
x3 , y3 , z3 = getElementPosition ( z_poj )
end
end
end
end
tbl ={}
--[[
if z_poj then
txt = getVehicleName ( z_poj )
else
txt = "0000"
end
dxDrawText ( txt , 0 , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), 1 , czc )
]]--
-- dxDrawRectangle ( recX , recY , recX2 , recY2 , tocolor ( 99 , 155 , 241 , 255 ))
--
--for i = 0 , 90 do
-- rrz2 = math . rad ( i )
-- px = recX + recX2 - ( 50 * math . sin (- rrz2 ))
-- py = recY + 50 - ( 50 * math . cos (- rrz2 ))
-- pw = py - recY
-- rrz3 = math . rad ( i + 180 )
-- py2 = recY + 50 +( recY2 - 100 ) - ( 50 * math . cos (- rrz3 ))
-- pw2 = recY + 50 +( recY2 - 100 )
-- px3 = recX - (- 50 * math . sin (- rrz2 ))
-- dxDrawRectangle ( px , py , 1 , ( recY2 - 50 - pw )+( py2 - pw2 ), tocolor ( 41 , 62 , 106 , 255 ))
-- dxDrawRectangle ( px3 , py , 1 , ( recY2 - 50 - pw )+( py2 - pw2 ), tocolor ( 41 , 62 , 106 , 255 ))
-- end
if not z_poj then
dxDrawImage ( sx / 2 - 144 , sy - 200 , 288 , 200 , "rejestratorwyl.png" )
else
dxDrawImage ( sx / 2 - 144 , sy - 200 , 288 , 200 , "rejestrator.png" )
end
local spd_last = 0
if not z_poj then
spd_last = 0
marka = nil
model = nil
kierowca = nil
driver = nil
id_driver = nil
dbid_poj = nil
return
else
spd = getElementSpeed ( z_poj , "km/h" )
spd_last =( spd_last + spd )
spd_last = string . format ( "%d" , spd_last )
marka = getVehicleName ( z_poj )
model = getElementModel ( z_poj )
kierowca = getVehicleController ( z_poj )
if kierowca then
driver = getPlayerName ( kierowca )
id_driver = getElementData ( kierowca , "id" )
end
dbid_poj = getElementData ( z_poj , "dbid" )
end
local time = getRealTime ()
time . month = time . month + 1
time . year = time . year + 1900
if ( time . month < 10 ) then
time . month = "0" .. time . month
end
if ( time . hour < 10 ) then
time . hour = "0" .. time . hour
end
if ( time . minute < 10 ) then
time . minute = "0" .. time . minute
end
if ( time . second < 10 ) then
time . second = "0" .. time . second
end
if ( time . monthday < 10 ) then
time . monthday = "0" .. time . monthday
end
czas = string . format ( "%s:%s:%s | %s.%s.%sr." , time . hour , time . minute , time . second , time . monthday , time . month , time . year )
dxDrawText ( string . format ( "Marka: %s Model: %s\n\nKierowca: %s [%s]\n\nCzas: %s\n\nNumery rejestracyjne: %s\n\nPr?dko??: %skm/h" , marka or "brak" , model or "brak" , driver or "brak" , id_driver or "X" , czas , dbid_poj or "brak" , spd_last or "brak" ), sx + 2 , sy - 180 + 2 , 0 , 0 , tocolor ( 0 , 0 , 0 , 255 ), 1 , czc , "center" )
dxDrawText ( string . format ( "Marka: %s Model: %s\n\nKierowca: %s [%s]\n\nCzas: %s\n\nNumery rejestracyjne: %s\n\nPr?dko??: %skm/h" , marka or "brak" , model or "brak" , driver or "brak" , id_driver or "X" , czas , dbid_poj or "brak" , spd_last or "brak" ), sx , sy - 180 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), 1 , czc , "center" ) -- sx / 2 - 200 , sy - 200 , 400 , 300
end
)
addCommandHandler ( "wideorejestrator" ,
function()
if not getElementData ( localPlayer , "dbid" ) then
exports [ "es-komunikaty" ]: komunikat ( "Najpierw si? zaloguj." )
return
end
if not isPolicjant ( localPlayer ) then
return
end
if wlaczony then
removeEventHandler ( "onClientRender" , root , dxdraw )
wlaczony = false
else
addEventHandler ( "onClientRender" , root , dxdraw )
wlaczony = true
end
end
)
Pozdrawiam
Ostatnio zmieniony przez ProBaton 2019-03-16, 00:10, w całości zmieniany 1 raz