Wysłany: 2018-07-10, 16:38
Assassin.
Wiek: 22 Na forum: 3380 dni Posty: 9
Nick w MP: Assassin
Piwa : 1
Cze??, naprawi?em ju? b??d w kodzie, teraz pytanie: czemu mimo i? mam w kodzie "root" widzi tekst tylko osoba, kt?ra wpisa?a komend??
Kod:
function drawText ()
dxDrawText ( text , screenW * 0.420 , screenH * 0 , screenW * 0.500 , screenH * 0.20 , tocolor ( 0 , 0 , 0 , 255 ), 1.3 , "default" , "left" , "center" , false , false , false , false , false )
dxDrawText ( text , screenW * 0.420 + 1 , screenH * 0 + 1 , screenW * 0.500 + 1 , screenH * 0.20 + 1 , tocolor ( 0 , 100 , 255 , 255 ), 1.3 , "default" , "left" , "center" , false , false , false , false , false )
end
function doText ( command , ...)
if command == "oglosevent" then
if getElementData ( localPlayer , 'player:admin' ) then return end
ev = table . concat ({...}, " " )
text = "Event " .. ev .. " prowadzi " .. getPlayerName ( localPlayer )
addEventHandler ( "onClientRender" , root , drawText )
elseif command == "ogloseventoff" then
removeEventHandler ( "onClientRender" , root , drawText )
end
end
addCommandHandler ( "oglosevent" , doText )
addCommandHandler ( "ogloseventoff" , doText )
[ Dodano : 2018-07-10, 17:23 ]
Teraz zauwa?y?em, ?e jest to po stronie clienta, jednak?e to chyba nie jest powodem. Nie da si? przecie? ustawi? tego pod stron? serwera, bo linijka na to nie pozwala odpowiadaj?ca za u?o?enie i widoczno?? napisu na ekranie.
Wysłany: 2018-07-10, 17:42
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Nwm jak ty to robisz ale zamiast robi? 1 og?oszenie dla wszystkich graczy zr?b 1 og?oszenie dla 1 gracza. Czyli w p?tle all graczy i im wy?wietlasz, a gdy dasz inne og?oszenie to i tak ka?demu zmieni wi?c nie ma si? czym martwi?
Podpis
"amited" napisał/a :
Wysłany: 2018-07-10, 17:52
Assassin.
Wiek: 22 Na forum: 3380 dni Posty: 9
Nick w MP: Assassin
Piwa : 1
W tym problem, ?e nie wiem gdzie jest b??d. Co ?le zrobi?em, ?e widzi to tylko jedna osoba, zamiast wszystkich graczy, kt?rzy s? na serwerze?
Cytat: Czyli w p?tle all graczy i im wy?wietlasz, a gdy dasz inne og?oszenie to i tak ka?demu zmieni wi?c nie ma si? czym martwi?
Z tego co m?wisz mam rozumie?, ?e je?eli dam, aby wszyscy widzieli - widzi osoba, kt?ra wpisa?a komend?, a je?li zmieni? komunikat to zobacz? wszyscy?
Wysłany: 2018-07-11, 09:39
Hades.
Łiiiiiiiiii
Wiek: 22 Na forum: 4699 dni Posty: 372
Nick w MP: Hades
Piwa : 3214
Spr?buj tak:
function drawText ()
dxDrawText ( text , screenW * 0.420 , screenH * 0 , screenW * 0.500 , screenH * 0.20 , tocolor ( 0 , 0 , 0 , 255 ), 1.3 , "default" , "left" , "center" , false , false , false , false , false )
dxDrawText ( text , screenW * 0.420 + 1 , screenH * 0 + 1 , screenW * 0.500 + 1 , screenH * 0.20 + 1 , tocolor ( 0 , 100 , 255 , 255 ), 1.3 , "default" , "left" , "center" , false , false , false , false , false )
end
function doText ( command , ...)
if not getElementData ( localPlayer , "player:admin" ) then return end
if command == "oglosevent" then
for i , v in ipairs ( getElementsByType ( "player" )) do
ev = table . concat ({...}, " " )
text = "Event " .. ev .. " prowadzi " .. getPlayerName ( localPlayer )
addEventHandler ( "onClientRender" , root , drawText )
end
elseif command == "ogloseventoff" then
for i , v in ipairs ( getElementsByType ( "player" )) do
removeEventHandler ( "onClientRender" , root , drawText )
end
end
end )
Wysłany: 2018-07-11, 12:28
Assassin.
Wiek: 22 Na forum: 3380 dni Posty: 9
Nick w MP: Assassin
Piwa : 1
Bez zmian, nadal widzi to u?ytkownik komendy :c
Wysłany: 2018-07-11, 12:39
Kalizman
Wiek: 23 Na forum: 3651 dni Posty: 1394
Piwa : 4619
function doText ( command , ...)
if not getElementData ( localPlayer , "player:admin" ) then return end
if command == "oglosevent" then
for i , v in ipairs ( getElementsByType ( "player" )) do
ev = table . concat ({...}, " " )
text = "Event " .. ev .. " prowadzi " .. getPlayerName ( localPlayer )
addEventHandler ( "onClientRender" , v , drawText )
end
elseif command == "ogloseventoff" then
for i , v in ipairs ( getElementsByType ( "player" )) do
removeEventHandler ( "onClientRender" , v , drawText )
end
end
end )
Wysłany: 2018-07-11, 12:57
Assassin.
Wiek: 22 Na forum: 3380 dni Posty: 9
Nick w MP: Assassin
Piwa : 1
"Kalizman" napisał/a : function doText ( command , ...)
if not getElementData ( localPlayer , "player:admin" ) then return end
if command == "oglosevent" then
for i , v in ipairs ( getElementsByType ( "player" )) do
ev = table . concat ({...}, " " )
text = "Event " .. ev .. " prowadzi " .. getPlayerName ( localPlayer )
addEventHandler ( "onClientRender" , v , drawText )
end
elseif command == "ogloseventoff" then
for i , v in ipairs ( getElementsByType ( "player" )) do
removeEventHandler ( "onClientRender" , v , drawText )
end
end
end )
Wujek DB3 odpowiedzia?:
WARNING: event\c.lua:13: Bad usage @ 'addEventHandler' ['onClientRender' with this function is already handled]
Tagi: tekst
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: