Wysłany: 2016-02-13, 22:31
Patrix100
Amator LUA.
Wiek: 26 Na forum: 3887 dni Posty: 182
Nick w MP: .:Patrix:.
Piwa : 952
Witam mam taki kod:
--[[
lss - admin : raporty oraz podgl ? d log ? w
@ author Lukasz Biegaj < wielebny @ bestplay . pl >
@ copyright 2011 - 2013 Lukasz Biegaj < wielebny @ bestplay . pl >
@ license Dual GPLv2 / MIT
@ package MTA - XyzzyRP
@ link https : //github.com/lpiob/MTA-XyzzyRP GitHub
]]--
local text_display = textCreateDisplay ()
local gameView = textCreateTextItem ( "" , 0.01 , 0.3 , "medium" , 255 , 255 , 255 , 255 , 1 , "left" , "top" , 255 )
local reportView = textCreateTextItem ( "" , 0.99 , 0.7 , "low" , 255 , 255 , 255 , 255 , 1 , "right" , "top" , 255 )
-- textitem textCreateTextItem ( string text , float x , float y , [ string priority , int red = 255 , int green = 0 , int blue = 0 , int alpha = 255 , float scale = 1 , string alignX = "left" , string alignY = "top" , int shadowAlpha = 0 ] )
textDisplayAddText ( text_display , gameView )
textDisplayAddText ( text_display , reportView )
local gameView_contents ={ "Zas?b lss-admin zosta? zrestartowany" }
local reportView_contents ={}
local time = getRealTime ()
local tn = string . format ( "%04d%02d%02d%02d%02d%02d-%02d.txt" , time . year + 1900 , time . month , time . monthday , time . hour , time . minute , time . second , math . random ( 1 , 99 ))
local fh = fileCreate ( "logi/" .. tn )
-- fileClose ( fh )
function outputLog ( text )
if ( text and fh ) then
local time = getRealTime ()
local ts = string . format ( "%04d%02d%02d%02d%02d%02d> " , time . year + 1900 , time . month , time . monthday , time . hour , time . minute , time . second )
fileWrite ( fh , ts .. text .. "\n" )
fileFlush ( fh )
end
end
outputLog ( "Logowanie rozpocz?te" )
for i , v in ipairs ( getElementsByType ( "player" )) do
local accName = getAccountName ( getPlayerAccount ( v ) )
if accName and ( isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Support" ) ) or isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Admin" ) )) then
textDisplayAddObserver ( text_display , v )
end
end
function refresh_td ()
local tresc = table . concat ( gameView_contents , "\n" )
textItemSetText ( gameView , tresc )
local tt ={}
for i , v in ipairs ( reportView_contents ) do
if ( v [ 1 ]) then
table . insert ( tt , v [ 1 ])
end
end
tresc = table . concat ( tt , "\n" )
textItemSetText ( reportView , tresc )
end
function gameView_add ( text )
outputLog ( text )
table . insert ( gameView_contents , text )
if ( #gameView_contents>10) then
table . remove ( gameView_contents , 1 )
end
refresh_td ()
end
function reportView_remove ( id )
for i = #reportView_contents,1,-1 do --in ipairs(reportView_contents) do
if ( reportView_contents [ i ][ 2 ] and reportView_contents [ i ][ 2 ]== id ) then
table . remove ( reportView_contents , i )
end
end
end
function reportView_add ( text , id )
if ( string . len ( text )> 0 ) then
outputLog ( "RAPORT " .. text )
end
table . insert ( reportView_contents ,{ text , id })
if ( #reportView_contents>10) then
table . remove ( reportView_contents , 1 )
end
refresh_td ()
end
-- setTimer (function()
-- reportView_add ( "" )
-- end , 5 * 60000 , 0 )
addEventHandler ( "onPlayerQuit" , root , function()
local id = getElementData ( source , "id" )
if ( id and tonumber ( id )) then
reportView_remove ( tonumber ( id ))
end
end )
addEventHandler ( "onPlayerLogin" , root , function()
local accName = getAccountName ( getPlayerAccount ( source ) )
if accName and isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Support" ) ) then
textDisplayAddObserver ( text_display , source )
gameView_add ( "### " .. accName .. " zalogowa?/a si?." )
setElementData ( source , "admin:rank" , 1 )
elseif accName and isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Admin" ) ) then
textDisplayAddObserver ( text_display , source )
end
end )
addEventHandler ( "onPlayerLogout" , root , function( acc )
accName = getAccountName ( acc )
if ( textDisplayIsObserver ( text_display , source )) then
textDisplayRemoveObserver ( text_display , source )
-- gameView_add ( "### " .. accName .. " wylogowa?/a si?." )
removeElementData ( source , "admin:rank" )
end
end )
addCommandHandler ( "ucho" , function( plr , cmd )
if ( textDisplayIsObserver ( text_display , plr )) then
textDisplayRemoveObserver ( text_display , plr )
else
textDisplayAddObserver ( text_display , plr )
end
end , true , false )
refresh_td ()
I nie wiem jak podpi?? to pod te skrypty:
To jest skrypt na chat.
function onPlayerChatSend ( msg , type )
if type == 0 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local col = createColSphere ( x , y , z , 30 )
for i , v in ipairs ( getElementsWithinColShape ( col , "player" )) do
outputChatBox ( "#90FF00(" .. getElementData ( source , "id" ).. "#90FF00)#ECFFD5" .. getPlayerName ( source ).. ":#90FF00" .. msg , v , 255 , 255 , 255 , true )
end
destroyElement ( col )
end
end
addEventHandler ( "onPlayerChat" , getRootElement (), onPlayerChatSend )
function onPlayerChatDo ( plr , commands , ...)
local msg = table . concat ( {...}, " " )
local x , y , z = getElementPosition ( plr )
local col = createColSphere ( x , y , z , 50 )
for i , v in ipairs ( getElementsWithinColShape ( col , "player" )) do
outputChatBox ( "#FF3000*" .. getPlayerName ( plr ).. " #FF3000" .. msg .. "#FF3000*" , v , 255 , 255 , 255 , true )
end
destroyElement ( col )
end
addCommandHandler ( "do" , onPlayerChatDo )
function onPlayerChatSend ( msg , type )
if type == 1 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local col = createColSphere ( x , y , z , 50 )
for i , v in ipairs ( getElementsWithinColShape ( col , "player" )) do
outputChatBox ( "#FF004E*" .. getPlayerName ( source ).. " #FF004E" .. msg , v , 255 , 255 , 255 , true )
end
destroyElement ( col )
end
end
addEventHandler ( "onPlayerChat" , getRootElement (), onPlayerChatSend )
A to jest skrypt na pm:
function prywatne ( plr , cmd , cel , ...)
if ( #arg<=0 or (not cel)) then
outputChatBox ( "U?yj: /pm <nick/id> <tresc>" , plr )
return
end
local target = findPlayer ( plr , cel )
if ( not target ) then
outputChatBox ( "Nie znaleziono gracza o podanym ID/nicku!" , plr )
return
end
local pwoff = getElementData ( target , "pwoff" )
if ( pwoff ) then
outputChatBox ( getPlayerName ( target ).. " nie akceptuje wiadomo?ci PW." , plr )
if ( type ( pwoff )== "string" ) then
outputChatBox ( "Pow?d: " .. pwoff , plr )
end
return
end
if getElementData ( plr , "pwoff" ) then
outputChatBox ( "Posiadasz wy??czone odbieranie wiadomo?ci, ta osoba nie b?dzie mog?a Ci odpisa?." , plr )
end
local tresc = table . concat ( arg , " " )
outputChatBox ( "<< #919191" .. getPlayerName ( plr ) .. "#0053FF[" .. getPlayerID ( plr ) .. "]:#ffffff " .. tresc , target , 255 , 255 , 255 , true )
outputChatBox ( ">> #919191" .. getPlayerName ( target ) .. "#0053FF[" .. getPlayerID ( target ) .. "]:#ffffff " .. tresc , plr , 255 , 255 , 255 , true )
outputDebugString ( "PM " .. getPlayerName ( plr ).. " - " .. getPlayerName ( target ).. " : " .. tresc )
playSoundFrontEnd ( target , 12 )
end
addCommandHandler ( "pm" , prywatne )
addCommandHandler ( "pw" , prywatne )
addCommandHandler ( "pmon" , function( plr , cmd )
removeElementData ( plr , "pwoff" )
outputChatBox ( "(( Odbieranie wiadomo?ci w??czone. ))" , plr )
return
end )
addCommandHandler ( "pmoff" , function( plr , cmd , ...)
local powod = table . concat ( arg , " " )
if ( not powod or string . len ( powod )< 2 ) then powod = true end
setElementData ( plr , "pwoff" , powod )
outputChatBox ( "(( Odbieranie wiadomo?ci wy??czone. ))" , plr )
return
end )
Wysłany: 2016-02-13, 22:34
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
Technika posz?a do przodu, zr?b to na dxDrawText : D
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2016-02-13, 22:36
Patrix100
Amator LUA.
Wiek: 26 Na forum: 3887 dni Posty: 182
Nick w MP: .:Patrix:.
Piwa : 952
"Jurandovsky" napisał/a :Technika posz?a do przodu, zr?b to na dxDrawText : D
To jest skrypt z xyzzyrp i nie ogarniam wgl go xd Moglbys dac "gotowca" bo bede sie z tym meczyl
Wysłany: 2016-02-13, 22:45
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
musisz striggerowa? funkcj? od 'ucha' czyli od tego add_gameView czy jako? tak, do server-side i tam jej u?y? podaj?c jako argument to co napisa? gracz a nastepnie wy?wietli? ; p
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2016-02-13, 23:16
Patrix100
Amator LUA.
Wiek: 26 Na forum: 3887 dni Posty: 182
Nick w MP: .:Patrix:.
Piwa : 952
"Jurandovsky" napisał/a :musisz striggerowa? funkcj? od 'ucha' czyli od tego add_gameView czy jako? tak, do server-side i tam jej u?y? podaj?c jako argument to co napisa? gracz a nastepnie wy?wietli? ; p
Jest jeden problem xd nie potrafi? triggerowac
Tagi: jak :: podpiac :: skrypt?
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: