Wysłany: 2017-01-28, 10:16
Kuksss
guwno
Wiek: 22 Na forum: 3781 dni Posty: 102
Nick w MP: guwnp
Piwa : 732
Czesc,
Mam skypt na komendy /me i /do, wszystko dzia?a dobrze, ale podstawowy zas?b MTA nadal dzia?a, wi?c po wpisaniu /me czy /do pojawia si? podw?jny tekst. Jeden na chacie lokalnym, a drugi na globalnym
Prosz? o szybk? pomoc, poniewa? serwer ju? dzisiaj startuje, stawiam !
Wysłany: 2017-01-28, 10:41
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Masz event onPlayerChat i onPlayerCommand przed tymi do i me musisz dac cancelEvent() a potem dalsza czesc kodu.
Wysłany: 2017-01-28, 10:45
Kuksss
guwno
Wiek: 22 Na forum: 3781 dni Posty: 102
Nick w MP: guwnp
Piwa : 732
Hazmudex , 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 ( "#FF0000*" .. getPlayerName ( plr ).. " #FFFFFF" .. msg .. "#FF0000*" , 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 ( "#0066FF*" .. getPlayerName ( source ).. " #0066FF: #0066FF" .. msg , v , 255 , 255 , 255 , true )
end
destroyElement ( col )
end
end
addEventHandler ( "onPlayerChat" , getRootElement (), onPlayerChatSend )
Czemu to nie dzia?a?
Wysłany: 2017-01-28, 12:15
MIKAELmta
Wiek: 24 Na forum: 3979 dni Posty: 311
Piwa : 10617
local function playerChat ( message , messageType )
if messageType == 1 then
cancelEvent ()
local red , green , blue = 255 , 255 , 255
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 )< 100 ) then
outputChatBox ( "#0033ff** " .. getPlayerName ( source ).. " " .. message , gracze , red , green , blue , true )
end
end
Zobacz czy dzia?a.
Wysłany: 2017-01-28, 16:59
Kuksss
guwno
Wiek: 22 Na forum: 3781 dni Posty: 102
Nick w MP: guwnp
Piwa : 732
MIKAELmta , Tw?j kod wcale nie dzia?a, nie pojawia mi si? nawet podw?jna wiadomo??.
Wysłany: 2017-01-28, 17:35
MIKAELmta
Wiek: 24 Na forum: 3979 dni Posty: 311
Piwa : 10617
local function playerChat ( message , messageType )
if messageType == 1 then --Global ( main ) chat
cancelEvent ()
local red , green , blue = 255 , 255 , 255
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 )< 100 ) then
outputChatBox ( "#0033ff** " .. getPlayerName ( source ).. " " .. message , gracze , red , green , blue , true )
end
end
end
end
addEventHandler ( "onPlayerChat" , root , playerChat )
Tagi: /me :: /do
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: