Odważny
Początki LUA :P
Wiek: 25 Na forum: 3739 dni Posty: 140
Nick w MP: ReseT_
Piwa : 166
witam, chc? ?eby m?j skrypt na logi serwerowe po lewej stronie wy?wietla? logi z mojego czatu
oto kod mojego czatu g??wnego:
addEventHandler ( "onPlayerChat" , root , function( tresc , msgtype )
if ( msgtype == 0 ) then
cancelEvent ()
local x , y , z = getElementPosition ( source )
for key , gracze in ipairs ( getElementsByType ( "player" )) do
local x2 , y2 , z2 = getElementPosition ( gracze )
if ( getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )< 50 ) then
local int = getElementInterior ( source )
local dim = getElementDimension ( source )
local int2 = getElementInterior ( gracze )
local dim2 = getElementDimension ( gracze )
local id = getElementData ( source , "id" )
if ( int == int2 and dim == dim2 ) then
outputChatBox ( "#00FF1A[#ffffff" .. getElementData ( source , "id" ).. "#00FF1A] #ffffff" .. getPlayerName ( source ) .. ": #ffffff" .. tresc , gracze , 255 , 255 , 255 , true )
end
end
end
end
end )
a oto kod na logi serwerowe(chc? zeby pisa?o po lewej stronie pod napisem Logi serwerowe ?eby pisa?o kto co pisze):
local xtext = nil
local gameView ={ "Logi serwerowe:" }
local reportView ={ "Lista raport?w:" }
local sx , sy = guiGetScreenSize ()
addEventHandler ( "onClientRender" , root , function()
if not getElementData ( localPlayer , "administracjaduty" ) then return end
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-bold" , "left" , "top" , false , true )
dxDrawText ( concat , sx *( 10 )/ 1024 , sy *( 279 )/ 768 , sx *( 326 )/ 1024 , sy *( 497 )/ 768 , white , 1.00 , "default-bold" , "left" , "top" , false , true )
end )
function renderingInfo ()
dxDrawRectangle ( sx *( 258 )/ 1024 , sy *( 0 )/ 768 , sx *( 500 )/ 1024 , sy *( 23 )/ 768 , 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-bold" , "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-bold" , "center" , "center" , false , true )
end
addEventHandler ( "onClientRender" , root , function()
if not getElementData ( localPlayer , "administracjaduty" ) then return end
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-bold" , "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-bold" , "right" , "top" , false , true )
end )
addEvent ( "onPlayerChat" , true )
addEventHandler ( "onPlayerChat" , root , function( text )
table . insert ( gameView , text )
if #gameView > 10 then
table . remove ( gameView , 1 )
end
end )
addEvent ( "admin:addRaport" , true )
addEventHandler ( "admin:addRaport" , root , function( text , id )
table . insert ( reportView , { text , id })
if #reportView > 10 then
table . remove ( reportView , 1 )
end
end )
addEvent ( "admin:removeRaport" , true )
addEventHandler ( "admin:removeRaport" , 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 )
Podpis
[you]
, pomogłem Ci? Wynagrodź mnie