Wilkuu*
InsideMTA.pl
Wiek: 23 Na forum: 3572 dni Posty: 50
Nick w MP: Wilku.
Piwa : 268
Chcia?bym by to by?o na ACL za pomoc daje i
Client:
addCommandHandler ( "gp" ,function( plr )
outputChatBox ( "Interior: " .. getElementInterior ( localPlayer ) .. " Dimension: " .. getElementDimension ( localPlayer ))
local x , y , z = getElementPosition ( localPlayer )
local xr , yr , zr = getElementRotation ( localPlayer )
p = string . format ( "%.2f,%.2f,%.2f" , x , y , z )
setClipboard ( p )
outputChatBox ( "Pozycja gracza: {" .. p .. "}," )
-- outputChatBox ( "Pozycja Rotacji: " .. xr .. ", " .. yr .. ", " .. zr , plr )
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
local x , y , z = getElementPosition ( veh )
local rx , ry , rz = getElementRotation ( veh )
local ID = getElementModel ( veh )
local Model = getVehicleName ( veh )
p = string . format ( "%.2f,%.2f,%.2f,%.1f,%.1f,%.1f" , x , y , z , rx , ry , rz )
setClipboard ( p )
outputChatBox ( "*Pozycja pojazdu:(" .. p .. ")," )
outputChatBox ( "*Nazwa Pojazdu:" .. Model .. " \n*ID Pojazdu " .. ID .. "." )
end
end )
addCommandHandler ( "gp2" ,function( plr )
outputChatBox ( "Interior: " .. getElementInterior ( localPlayer ) .. " Dimension: " .. getElementDimension ( localPlayer ))
local x , y , z = getElementPosition ( localPlayer )
local xr , yr , zr = getElementRotation ( localPlayer )
p = string . format ( "%.2f,%.2f,%.2f" , x , y , z )
setClipboard ( p )
outputChatBox ( "Pozycja gracza: " .. p .. " " )
outputChatBox ( "Pozycja rotacji: " .. xr .. ", " .. yr .. ", " .. zr , plr )
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
local x , y , z = getElementPosition ( veh )
local rx , ry , rz = getElementRotation ( veh )
local ID = getElementModel ( veh )
local Model = getVehicleName ( veh )
p = string . format ( "%.2f,%.2f,%.2f,%.1f,%.1f,%.1f" , x , y , z , rx , ry , rz )
setClipboard ( p )
outputChatBox ( "*Pozycja pojazdu:(" .. p .. ")," )
outputChatBox ( "*Nazwa Pojazdu:" .. Model .. " \n*ID Pojazdu " .. ID .. "." )
end
end )
local xtext = nil
local gameView ={ " " }
local reportView ={ "Lista raport?w:" }
local sx , sy = guiGetScreenSize ()
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "duty" ) == 1 or getElementData ( localPlayer , "duty" ) == 2 or getElementData ( localPlayer , "duty" ) == 3 then
concat = table . concat ( gameView , "\n" )
dxDrawText ( concat , sx *( 10 + 1 )/ 1024 , sy *( 279 + 1 )/ 768 , sx *( 326 + 1 )/ 1024 , sy *( 497 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , true )
dxDrawText ( concat , sx *( 10 )/ 1024 , sy *( 279 )/ 768 , sx *( 326 )/ 1024 , sy *( 497 )/ 768 , white , 1.00 , "default" , "left" , "top" , false , true )
end
end )
function renderingInfo ()
-- dxDrawRectangle ( sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 500 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 0 , 0 , 0 , 155 ), false )
dxDrawRectangle ( sx *( 843 )/ 1280 , sy *( 536 )/ 600 , sx *( 427 )/ 1280 , sy *( 28 )/ 600 , tocolor ( 0 , 0 , 0 , 155 ), false )
-- dxDrawText ( xtext , sx *( 258 + 1 )/ 1024 , sy *( 0 + 1 )/ 768 , sx *( 758 + 1 )/ 1024 , sy *( 23 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
-- dxDrawText ( xtext , sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 758 )/ 1024 , sy *( 23 )/ 768 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false , true )
dxDrawText ( xtext , sx *( 860 + 1 )/ 1280 , sy *( 542 + 1 )/ 600 , sx *( 1260 + 1 )/ 1280 , sy *( 560 + 1 )/ 600 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
dxDrawText ( xtext , sx *( 860 )/ 1280 , sy *( 542 )/ 600 , sx *( 1260 )/ 1280 , sy *( 560 )/ 600 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , "default" , "left" , "top" , false , false , false , false , false )
dxDrawImage ( sx *( 1242 )/ 1280 , sy *( 541 )/ 600 , sx *( 24 )/ 1280 , sy *( 19 )/ 600 , ":dutyAdministracji/img/mark.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "duty" ) == 1 or getElementData ( localPlayer , "duty" ) == 2 or getElementData ( localPlayer , "duty" ) == 3 then
local tt ={}
for i , v in ipairs ( reportView ) do
if v [ 1 ] then table . insert ( tt , v [ 1 ]) end
end
concat = table . concat ( tt , "\n" )
dxDrawText ( concat , sx *( 698 + 1 )/ 1024 , sy *( 278 + 1 )/ 768 , sx *( 1014 + 1 )/ 1024 , sy *( 496 + 1 )/ 768 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default" , "right" , "top" , false , true )
dxDrawText ( concat , sx *( 698 )/ 1024 , sy *( 278 )/ 768 , sx *( 1014 )/ 1024 , sy *( 496 )/ 768 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "right" , "top" , false , true )
end
end )
addEvent ( "admin:addText" , true )
addEventHandler ( "admin:addText" , root , function( text )
table . insert ( gameView , text )
if #gameView > 20 then
table . remove ( gameView , 1 )
end
end )
addEvent ( "admin:addReport" , true )
addEventHandler ( "admin:addReport" , root , function( text , id )
table . insert ( reportView , { text , id })
if #reportView > 20 then
table . remove ( reportView , 1 )
end
end )
addEvent ( "admin:removeReport" , true )
addEventHandler ( "admin:removeReport" , root , function( id )
for i = #reportView, 1, -1 do
if reportView [ i ][ 2 ] == id then
table . remove ( reportView , i )
end
end
end )
addEvent ( "admin:rendering" , true )
addEventHandler ( "admin:rendering" , root , function( text )
xtext = text
addEventHandler ( "onClientRender" , root , renderingInfo )
setTimer (function()
removeEventHandler ( "onClientRender" , root , renderingInfo )
end , 5000 , 1 )
end )
Serwer:
function jestRCONem ( gracz )
if getElementData ( gracz , "duty" ) == 3 then return true end
end
function jestADMINem ( gracz )
if getElementData ( gracz , "duty" ) == 2 then return true end
end
function jestModem ( gracz )
if getElementData ( gracz , "duty" ) == 1 then return true end
end
addCommandHandler ( "admins" , function( gracz , cmd )
admini = {}
rconi = {}
moderatorzy = {}
for k , v in ipairs ( getElementsByType ( "player" )) do
if jestRCONem ( v ) then
table . insert ( rconi , getPlayerName ( v ))
elseif jestModem ( v ) then
table . insert ( moderatorzy , getPlayerName ( v ))
elseif jestADMINem ( v ) then
table . insert ( admini , getPlayerName ( v ))
end
end
for i = 0 , 1 do
outputChatBox ( " " , gracz )
end
outputChatBox ( "* Dost?pni RCON'i:" , gracz , 255 , 0 , 0 )
if #rconi > 0 then
outputChatBox ( table . concat ( rconi , ", " ), gracz )
else
outputChatBox ( "brak" , gracz )
end
outputChatBox ( " " , gracz )
outputChatBox ( "* Dost?pni administratorzy:" , gracz , 0 , 100 , 255 )
if #admini > 0 then
outputChatBox ( table . concat ( admini , ", " ), gracz )
else
outputChatBox ( "brak" , gracz )
end
outputChatBox ( " " , gracz )
outputChatBox ( "* Dost?pni moderatorzy:" , gracz , 0 , 255 , 0 )
if #moderatorzy > 0 then
outputChatBox ( table . concat ( moderatorzy , ", " ), gracz )
else
outputChatBox ( "brak" , gracz )
end
outputServerLog ( getPlayerName ( gracz ).. " sprawdza list? dost?pnych cz?onk?w ekipy." )
end
)
-- Ustawienia SQL
addEventHandler ( "onResourceStart" , resourceRoot , function()
db = dbConnect ( "sqlite" , "da.db" ) -- Po ?? czenie z serwerem SQL
if db then
outputDebugString ( "Po??czono z baz? SQL duty administracji //Your Legal Life" )
end
end )
-- Reszta zasobu
addCommandHandler ( "duty" , function( plr , cmd )
local q = dbQuery ( db , "SELECT level FROM admins WHERE login=?" , getAccountName ( getPlayerAccount ( plr )))
local w = dbPoll ( q , - 1 )
if w and #w > 0 then
if not getElementData ( plr , "duty" ) then
if w [ 1 ]. level == 1 then -- Je ? eli kolumna 'level' ma warto ?? 1 to nadajemy rang ? moderatora .
setElementData ( plr , "duty" , 1 )
outputChatBox ( "Logujesz si? na duty moderatora." , plr )
elseif w [ 1 ]. level == 2 then -- Je ? eli kolumna 'level' ma warto ?? 2 to nadajemy rang ? administratora .
setElementData ( plr , "duty" , 2 )
outputChatBox ( "Loguejsz si? na duty administratora." , plr )
elseif w [ 1 ]. level == 3 then -- Je ? eli kolumna 'level' ma warto ?? 3 to nadajemy rang ? administratora RCON .
setElementData ( plr , "duty" , 3 )
outputChatBox ( "Logujesz si? na duty administratora RCON." , plr )
end
else
removeElementData ( plr , "duty" )
outputChatBox ( "Wylogowujesz si? z duty." , plr )
end
else
outputChatBox ( "Nie jeste? w ekipie serwera." , plr )
end
end )
addCommandHandler ( 'e' , function( plr , cmd , ...)
if not (...) then return end
local ranga = nil
local msg = table . concat ({...}, " " )
if getElementData ( plr , "duty" ) == 3 then
ranga = "RCON"
end
if getElementData ( plr , "duty" ) == 2 then
ranga = "ADM"
end
if getElementData ( plr , "duty" ) == 1 then
ranga = "MOD"
end
for _ , p in pairs ( getElementsByType ( 'player' )) do
if getElementData ( p , "duty" ) then
outputChatBox ( "[CE] " .. getPlayerName ( plr ).. " (" .. tonumber ( getElementData ( plr , "id" )).. ") " .. "[" .. ranga .. "]: " .. msg , p , 255 , 170 , 0 , true )
end
end
end )
--[[
Informacje :
Aby zas ? b dzia ? a ? poprawnie , musisz doda ? tabel ? do MySQL z nazw ? 'admins' ( bez apostrof ? w ) z kolumnami :
serial - typ VARCHAR - d ? ugo ?? 255
levle - typ INT - d ? ugo ?? 1
Aby doda ? gracza do administracji , dodaj do MySQL serial gracza oraz level
Level 1 - Moderator
Level 2 - Administrator
Level 3 - Administrator RCON
Aby pobra ? rang ? gracza przy np . robieniu komend :
aby sprawdzi ?, czy gracz jest moderatorem wpisujemy :
if getElementData ( plr , "duty" ) == 1 then
Reszta Twojego kodu .
end
aby sprawdzi ?, czy gracz jest administratorem wpisujemy :
if getElementData ( plr , "duty" ) == 2 then
Reszta Twojego kodu .
end
aby sprawdzi ?, czy gracz jest administratorem RCON wpisujemy :
if getElementData ( plr , "duty" ) == 3 then
Reszta Twojego kodu
end
]]--
-- Komedndy Chat
addCommandHandler ( "r" , function( plr , cmd , ...)
if getElementData ( plr , "duty" ) == 3 then
local text = table . concat ( arg , " " )
name = getPlayerName ( plr )
outputChatBox ( "R > " .. text .. " ~ " .. getPlayerName ( plr ).. "." , getRootElement (), 255 , 0 , 0 , true )
end
end )
addCommandHandler ( "a" , function( plr , cmd , ...)
if getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
local text = table . concat ( arg , " " )
name = getPlayerName ( plr )
outputChatBox ( "A > " .. text .. " ~ " .. getPlayerName ( plr ).. "." , getRootElement (), 0 , 100 , 255 , true )
end
end )
addCommandHandler ( "m" , function( plr , cmd , ...)
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 then
local text = table . concat ( arg , " " )
name = getPlayerName ( plr )
outputChatBox ( "M > " .. text .. " ~ " .. getPlayerName ( plr ).. "." , getRootElement (), 72 , 255 , 0 , true )
end
end )
--- d ? u ? ej
addCommandHandler ( "p" , function( plr , cmd , model )
if getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
local dim = getElementDimension ( plr )
local x , y , z = getElementPosition ( plr )
local r1 , r2 , r3 = getElementRotation ( plr )
local model = getVehicleModelFromName ( model )
if not tostring ( model ) then
outputChatBox ( "* Nie wpisa?e?(a?) modelu pojazdu." , plr )
return
end
if getPedOccupiedVehicle ( plr ) then
setElementModel ( getPedOccupiedVehicle ( plr ), model )
else
local pojazd = createVehicle ( model , x , y , z , r1 , r2 , r3 )
warpPedIntoVehicle ( plr , pojazd )
setElementDimension ( pojazd , dim )
setVehicleColor ( pojazd , 0 , 0 , 2 )
--- setElementData ( pojazd , "vehicle:fuel" , 100 )
setVehiclePlateText ( pojazd , "RESPIONE" )
end
end
end )
--[[ addCommandHandler ( "daj.rep" , function( plr , cmd , cel , value )
if getElementData ( plr , "duty" ) == 3 then
if not cel or not tonumber ( value ) then
outputChatBox ( "* U?ycie: /daj.rep <nick/ID> <ilosc>" , plr )
return
end
local target = findPlayer ( plr , cel )
if not target then
outputChatBox ( "* Nie znaleziono podanego gracza." , plr , 255 , 0 , 0 )
return
end
setElementData ( target , "Reputacja" , getElementData ( target , "Reputacja" )+ value )
outputChatBox ( "* Otrzyma?e?(a?) " .. value .. " Reputacji!" , target )
end
end
end )
]]
addCommandHandler ( "destroy" , function( plr , cmd , model )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
local pojazd = getVehicleOccupant ( source )
if not pojazd then return end
destroyElement ( pojazd )
end
end )
addCommandHandler ( "jp" , function( plr , cmd )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
if isPedInVehicle ( plr ) then
removePedFromVehicle ( plr )
end
if doesPedHaveJetPack ( plr ) then
removePedJetPack ( plr )
else
givePedJetPack ( plr )
end
end
end )
addCommandHandler ( "dim" , function( plr , cmd , value )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
if ( not value ) then
outputChatBox ( "U?yj: /dim <numer>" , plr )
return
end
setElementDimension ( plr , value )
end
end )
addCommandHandler ( "thv" , function( plr , cmd , vid )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
if not tonumber ( vid ) then return end
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if getElementData ( v , "car_id" ) == tonumber ( vid ) then
local x , y , z = getElementPosition ( plr )
setElementFrozen ( v , false )
warpPedIntoVehicle ( plr , v )
setElementPosition ( v , x , y , z )
setElementInterior ( v , getElementInterior ( plr ))
setElementDimension ( v , getElementDimension ( plr ))
return
end
end
end
outputChatBox ( "* Nie posiadasz uprawnie? do u?ywania tej komendy, b?d? nie znaleziono auta o podanym ID!" , plr , 255 , 0 , 0 )
end )
addCommandHandler ( "inv" , function( plr )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
if getElementAlpha ( plr ) > 0 then
setElementAlpha ( plr , 0 )
setPlayerNametagShowing ( plr , false )
else
setElementAlpha ( plr , 255 )
setPlayerNametagShowing ( plr , true )
end
end
end )
function getPointFromDistanceRotation ( x , y , dist , angle )
local a = math . rad ( 90 - angle );
local dx = math . cos ( a ) * dist ;
local dy = math . sin ( a ) * dist ;
return x + dx , y + dy ;
end
addCommandHandler ( "ustaw.klatke" , function( plr )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
local x , y , z = getElementPosition ( plr )
local dim = getElementDimension ( plr )
local int = getElementInterior ( plr )
local object = createObject ( 971 , x , y , z - 0.9 , 270 , 0 , 180 )
setElementData ( object , "owner" , getPlayerName ( plr ))
setElementDimension ( object , dim )
setElementInterior ( object , int )
local object = createObject ( 971 , x , y , z + 6 , 270 , 0 , 180 )
setElementData ( object , "owner" , getPlayerName ( plr ))
setElementDimension ( object , dim )
setElementInterior ( object , int )
local object = createObject ( 971 , x , y + 3.5 , z + 2.5 , 0 , 0 , 0 )
setElementData ( object , "owner" , getPlayerName ( plr ))
setElementDimension ( object , dim )
setElementInterior ( object , int )
local object = createObject ( 971 , x - 4.5 , y , z + 2.5 , 0 , 0 , 270 )
setElementData ( object , "owner" , getPlayerName ( plr ))
setElementDimension ( object , dim )
setElementInterior ( object , int )
local object = createObject ( 971 , x , y - 3.5 , z + 2.5 , 0 , 0 , 180 )
setElementData ( object , "owner" , getPlayerName ( plr ))
setElementDimension ( object , dim )
setElementInterior ( object , int )
local object = createObject ( 971 , x + 4 , y , z + 2.5 , 0 , 0 , 270 )
setElementData ( object , "owner" , getPlayerName ( plr ))
setElementDimension ( object , dim )
setElementInterior ( object , int )
outputChatBox ( "* Stworzy?es/a? klatk?." , plr )
end
end )
addCommandHandler ( "usun.klatke" , function( plr )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
for i , v in ipairs ( getElementsByType ( "object" )) do
if getElementData ( v , "owner" ) == getPlayerName ( plr ) then
destroyElement ( v )
end
end
end
end )
addCommandHandler ( "fix" , function( plr , cmd )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
local veh = getPedOccupiedVehicle ( plr )
if not veh then
outputChatBox ( "* Nie znajdujesz si? w poje?dzie." , plr )
return
end
setElementHealth ( veh , 1000 )
fixVehicle ( veh )
end
end )
addCommandHandler ( "pj" ,function( plr , cmd , pj )
if getElementData ( plr , "duty" ) == 3 then
if not pj or not tonumber ( pj ) then outputChatBox ( "*Wpisz /pj [0-3]" , plr ) return end
local pj = tonumber ( pj )
if pj < 0 or pj > 3 then outputChatBox ( "*Wpisz /pj [0-3]" , plr ) return end
local veh = getPedOccupiedVehicle ( plr )
if not veh then outputChatBox ( "* Nie znajdujesz si? w pojezdzie." , plr ) return end
setVehiclePaintjob ( veh , pj )
end
end )
addCommandHandler ( "cfix" , function( plr , cmd , range )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
if ( not range ) then
outputChatBox ( "U?yj: /cfix <zasieg>" , plr )
return end
if not tonumber ( range ) then
outputChatBox ( "* /cfix <zasieg>" , plr )
return end
range = tonumber ( range )
if range <= 0 then
outputChatBox ( "* Za mala odleglosc" , plr )
return end
if range > 50 then
outputChatBox ( "* Za duza odleglosc" , plr )
return end
local x , y , z = getElementPosition ( plr )
local cub = createColSphere ( x , y , z , range )
local pojazdy = getElementsWithinColShape ( cub , "vehicle" )
if #pojazdy == 0 then
outputChatBox ( "* Brak pojazdow w poblizu" , plr )
return end
for i , pojazd in ipairs ( pojazdy ) do
fixVehicle ( pojazd )
end
setTimer ( destroyElement , 5000 , 1 , cub )
end
end )
addCommandHandler ( "xyz" ,
function( player , cmd , x , y , z )
if getElementData ( player , "duty" ) == 3 then
local x , y , z = tonumber ( x ), tonumber ( y ), tonumber ( z )
if x and y and z then
setElementPosition ( player , x , y , z )
outputChatBox ( "Ustawi?e? Pozycje." , player , 220 , 220 , 0 , false )
else
outputChatBox ( "TP: /xyz <x> <y> <z>" , player , 220 , 220 , 0 , false )
end
end
end )
function flip ( plr )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 3 or getElementData ( plr , "duty" ) == 2 then
if isPedInVehicle ( plr ) then
local veh = getPedOccupiedVehicle ( plr )
local x , y , z = getElementRotation ( veh )
setElementRotation ( veh , 0 , 0 , z )
end
end
end
addCommandHandler ( 'flip' , flip )
addCommandHandler ( "ustaw.pogode" , function( plr , cmd , value )
if getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if not tonumber ( value ) then
outputChatBox ( "* Nie wpisa?e? id pogody." , plr )
return
end
if tonumber ( value ) > 175 then
outputChatBox ( "* Wpisa?e? du?e id pogody." , plr )
return
end
end
setWeather ( value )
end )
addCommandHandler ( "up" , function( plr , cmd , value )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if ( tonumber ( value )== nil ) then
outputChatBox ( "U?yj: /up <ile>" , plr )
return
end
local e = plr
if ( isPedInVehicle ( plr )) then
e = getPedOccupiedVehicle ( plr )
end
local x , y , z = getElementPosition ( e )
setElementPosition ( e , x , y , z + tonumber ( value ))
end
end )
addCommandHandler ( "thru" , function( plr , cmd , value )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if ( tonumber ( value )== nil ) then
outputChatBox ( "U?yj: /thru <ile>" , plr )
return
end
local e = plr
if getCameraTarget ( plr ) ~= plr then
e = getCameraTarget ( plr )
end
if ( isPedInVehicle ( plr )) then
e = getPedOccupiedVehicle ( e )
end
local x , y , z = getElementPosition ( e )
local _ , _ , rz = getElementRotation ( e )
local rrz = math . rad ( rz )
local x = x + ( value * math . sin (- rrz ))
local y = y + ( value * math . cos (- rrz ))
setElementPosition ( e , x , y , z )
end
end )
addCommandHandler ( "tt" , function( plr , cmd , cel )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if not cel then
outputChatBox ( "* U?yj: /tt <nick/ID>" , plr )
return
end
local target = findPlayer ( plr , cel )
if not target then
outputChatBox ( "* Nie znaleziono podanego gracza!" , plr )
return
end
local x , y , z = getElementPosition ( target )
setElementInterior ( plr , getElementInterior ( target ))
setElementDimension ( plr , getElementDimension ( target ))
setElementPosition ( plr , x + 1 , y + 1 , z )
end
end )
addCommandHandler ( "th" , function( plr , cmd , cel )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if not cel then
outputChatBox ( "* U?yj: /th <nick/ID>" , plr )
return
end
local target = findPlayer ( plr , cel )
local x , y , z = getElementPosition ( plr )
if not target then
outputChatBox ( "* Nie znaleziono podanego gracza!" , plr )
return
end
if isPedInVehicle ( target ) then
removePedFromVehicle ( target )
end
setElementInterior ( target , getElementInterior ( plr ))
setElementDimension ( target , getElementDimension ( plr ))
setElementPosition ( target , x , y , z + 1.5 )
end
end )
addCommandHandler ( "spec" , function( plr , cmd , cel )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
end
if ( not cel ) then
outputChatBox ( "U?yj: /spec <id/nick" , plr )
return
end
local target = findPlayer ( plr , cel )
if ( not target ) then
outputChatBox ( "Nie znaleziono gracza o podanym ID/nicku!" , plr )
return
end
setElementInterior ( plr , getElementInterior ( target ))
setElementDimension ( plr , getElementDimension ( target ))
local x , y , z = getElementPosition ( plr )
setElementData ( plr , "pozycja:x" , x )
setElementData ( plr , "pozycja:y" , y )
setElementData ( plr , "pozycja:z" , z )
setCameraTarget ( plr , target )
end )
addCommandHandler ( "specoff" , function( plr , cmd )
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
end
local x = getElementData ( plr , "pozycja:x" )
local y = getElementData ( plr , "pozycja:y" )
local z = getElementData ( plr , "pozycja:z" )
setElementPosition ( plr , x , y , z )
setCameraTarget ( plr , plr )
end )
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else -- podano fragment nicku
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wi?cej graczy o podobnym nicku, podaj wi?cej liter!" , plr )
return nil
end
target = thePlayer
end
end
end
return target
end
-----
addCommandHandler ( "raport" , function( plr , cmd , cel ,...)
if not cel then
outputChatBox ( "U?yj: /raport <kawa?ek nick'u> <pow?d>" , plr )
return
end
local target = findPlayer ( plr , cel )
if not target then
outputChatBox ( "Nie znaleziono podanego gracza." , plr , 255 , 0 , 0 )
return
end
local text = table . concat ({...}, " " )
desc = getPlayerName ( plr ).. "(" .. getElementData ( plr , "id" ).. ") >> " .. getPlayerName ( target ).. "(" .. getElementData ( target , "id" ).. "): " .. text
triggerClientEvent ( root , "admin:addReport" , resourceRoot , desc , getElementData ( target , "id" ))
outputChatBox ( "Pomy?lnie wys?ano zg?oszenie na gracza: " .. getPlayerName ( target ), plr )
end )
addCommandHandler ( "cl" , function( plr , cmd , id ,...)
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if not tonumber ( id ) then
outputChatBox ( "U?yj: /cl <ID> <pow?d usuni?cia>" , plr )
return
end
local reason = table . concat ({...}, " " )
local target = findPlayer ( plr , id )
if target then
id = getElementData ( target , "id" )
opis = getPlayerName ( target )
end
triggerClientEvent ( plr , "admin:removeReport" , resourceRoot , id )
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( plr , "duty" ) == 1 or getElementData ( plr , "duty" ) == 2 or getElementData ( plr , "duty" ) == 3 then
if getElementData ( v , "duty" ) == 1 or getElementData ( v , "duty" ) == 2 or getElementData ( v , "duty" ) == 3 then
outputChatBox ( "" .. getPlayerName ( plr ).. " usun??/??a raport na: " .. opis .. "/" .. id .. ": " .. reason , v , 255 , 0 , 0 )
end
end
end
end
end )