Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-07-10, 16:38


Assassin.







Wiek: 22
Na forum: 3380 dni
Posty: 9
Nick w MP: Assassin

Piwa: 1

Respekt: 50

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(textscreenW 0.420screenH 0screenW 0.500screenH 0.20tocolor(000255), 1.3"default""left""center"falsefalsefalsefalsefalse)
     dxDrawText(textscreenW 0.420+1screenH 0+1screenW 0.500+1screenH 0.20+1tocolor(0100255255), 1.3"default""left""center"falsefalsefalsefalsefalse)    
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"rootdrawText)   
    elseif command == "ogloseventoff" then
        removeEventHandler"onClientRender"rootdrawText) 
    end
end
addCommandHandler("oglosevent"doTextaddCommandHandler("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.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-10, 17:42


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

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:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-10, 17:52


Assassin.







Wiek: 22
Na forum: 3380 dni
Posty: 9
Nick w MP: Assassin

Piwa: 1

Respekt: 50

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?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-11, 09:39


Hades.

Łiiiiiiiiii






Wiek: 22
Na forum: 4699 dni
Posty: 372
Nick w MP: Hades

Piwa: 3214

Respekt: 337,8
Respekt: 337,8Respekt: 337,8Respekt: 337,8

Spr?buj tak:




function drawText() 
     dxDrawText(textscreenW 0.420screenH 0screenW 0.500screenH 0.20tocolor(000255), 1.3"default""left""center"falsefalsefalsefalsefalse)
     dxDrawText(textscreenW 0.420+1screenH 0+1screenW 0.500+1screenH 0.20+1tocolor(0100255255), 1.3"default""left""center"falsefalsefalsefalsefalse)    
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"rootdrawText)
    end
  elseif command == "ogloseventoff" then
    for i,v in ipairs(getElementsByType("player")) do
      removeEventHandler("onClientRender"rootdrawText)
    end
  end
end)



Podpis
Skrypty/Grafiki na zamówienie!
Kontakt: Discord R35#5507

Discord związany z pomocą: https://discord.gg/ttkQTsc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-11, 12:28


Assassin.







Wiek: 22
Na forum: 3380 dni
Posty: 9
Nick w MP: Assassin

Piwa: 1

Respekt: 50

Bez zmian, nadal widzi to u?ytkownik komendy :c

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-11, 12:39


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

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"vdrawText)
    end
  elseif command == "ogloseventoff" then
    for i,v in ipairs(getElementsByType("player")) do
      removeEventHandler("onClientRender"vdrawText)
    end
  end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-11, 12:57


Assassin.







Wiek: 22
Na forum: 3380 dni
Posty: 9
Nick w MP: Assassin

Piwa: 1

Respekt: 50

"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"vdrawText)
    end
  elseif command == "ogloseventoff" then
    for i,v in ipairs(getElementsByType("player")) do
      removeEventHandler("onClientRender"vdrawText)
    end
  end
end)


Wujek DB3 odpowiedzia?:
WARNING: event\c.lua:13: Bad usage @ 'addEventHandler' ['onClientRender' with this function is already handled]

Postaw piwo autorowi tego posta
 

 
Tagi: tekst
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku