Wysłany: 2017-07-28, 15:27
Kalizman
Wiek: 23 Na forum: 3651 dni Posty: 1394
Piwa : 4619
Witam, mam kod, kt?ry zapisuje logi w pliku .txt oraz na ?cianie log?w. Ale problem jest taki: gdy ilo?? graczy pisz?cych na czacie wynosi 3, to w pliku TXT oraz w logach pokazuj? si? trzy linijki jednego logu: "Lokalny> nick: cos tam", gdy 5 os?b rozmawia, w tedy w logach robi si? straszny burdel... Pokazuje si? 5 razy "Lokalny> nick: cos tam"
addEventHandler ( "onPlayerChat" , root , function( wiadomosc , typ )
if typ == 0 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local cuboid = createColSphere ( x , y , z , 30 )
local wCuboid = getElementsWithinColShape ( cuboid , "player" )
destroyElement ( cuboid )
for _ , p in ipairs ( wCuboid ) do
local nick = getPlayerName ( source )
local id = getElementData ( source , "id" ) or 0
local kolor = idRanga ( source )
wiadomosc = string . gsub ( wiadomosc , "#%x%x%x%x%x%x" , "" )
local info = "#aaaaaa[" .. id .. "] " .. kolor .. "" .. nick .. ": #ffffff" .. wiadomosc
local info2 = "[" .. id .. "] " .. nick .. ": " .. wiadomosc
outputChatBox ( info , p , 255 , 255 , 255 , true )
logczatulokalnego ( "Lokalny> " .. info2 )
triggerClientEvent ( "logi" , root , "Lokalny> " .. info2 )
end
elseif typ == 1 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local cuboid1 = createColSphere ( x , y , z , 30 )
local wCuboid1 = getElementsWithinColShape ( cuboid1 , "player" )
destroyElement ( cuboid1 )
for _ , p in ipairs ( wCuboid1 ) do
local nick1 = getPlayerName ( source )
wiadomosc1 = string . gsub ( wiadomosc , "#%x%x%x%x%x%x" , "" )
local text = "#00CC00" .. nick1 .. " " .. wiadomosc1
outputChatBox ( text , p , 255 , 255 , 255 , true )
logczatulokalnego ( "ME> " .. text )
triggerClientEvent ( "logi" , root , "ME> " .. text )
end
end
end )
Wysłany: 2017-07-28, 16:06
psychol.
Wiek: 23 Na forum: 3502 dni Posty: 225
Nick w MP: psychol.
Piwa : 2998
addEventHandler ( "onPlayerChat" , root , function( wiadomosc , typ )
if typ == 0 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local cuboid = createColSphere ( x , y , z , 30 )
local wCuboid = getElementsWithinColShape ( cuboid , "player" )
destroyElement ( cuboid )
for _ , p in ipairs ( wCuboid ) do
local nick = getPlayerName ( source )
local id = getElementData ( source , "id" ) or 0
local kolor = idRanga ( source )
wiadomosc = string . gsub ( wiadomosc , "#%x%x%x%x%x%x" , "" )
local info = "#aaaaaa[" .. id .. "] " .. kolor .. "" .. nick .. ": #ffffff" .. wiadomosc
info2 = "[" .. id .. "] " .. nick .. ": " .. wiadomosc
outputChatBox ( info , p , 255 , 255 , 255 , true )
end
logczatulokalnego ( "Lokalny> " .. info2 )
triggerClientEvent ( "logi" , root , "Lokalny> " .. info2 )
elseif typ == 1 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local cuboid1 = createColSphere ( x , y , z , 30 )
local wCuboid1 = getElementsWithinColShape ( cuboid1 , "player" )
destroyElement ( cuboid1 )
for _ , p in ipairs ( wCuboid1 ) do
local nick1 = getPlayerName ( source )
wiadomosc1 = string . gsub ( wiadomosc , "#%x%x%x%x%x%x" , "" )
text = "#00CC00" .. nick1 .. " " .. wiadomosc1
outputChatBox ( text , p , 255 , 255 , 255 , true )
end
logczatulokalnego ( "ME> " .. text )
triggerClientEvent ( "logi" , root , "ME> " .. text )
end
end )
Wysłany: 2017-07-28, 16:19
Kalizman
Wiek: 23 Na forum: 3651 dni Posty: 1394
Piwa : 4619
Tagi: gracze :: colshape :: [logi]
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: