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

Wysłany: 2016-08-01, 14:08


Xaar







Wiek: 26
Na forum: 5591 dni
Posty: 47
Nick w MP: PLWESOLYKOSTEK

Piwa: 82

Respekt: 60

Cze??, ot?? mam taki kod


local defScale = 0.1 --min scale
local currentScale = defScale
local maxScale = 3 --max scale
local step = 0.15 --increase lv
mojeW,mojeH = 640, 480
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

 
function renderPulse(root,tresc)
-- poczatek tresci do wpisania o komendzie /test
local tresc = table.concat({tresc}, " ")
        -- poczatek animacji dxdraw
    currentScale = currentScale + step
    if currentScale > maxScale then
      currentScale = maxScale
    end
   dxDrawText(tresc,300*width, 20*height, 560*width, 260*height,tocolor(255,255,255,255),currentScale,"default-bold","left","top",false,false,false,true)
end
addCommandHandler("draw",renderPulse)

 function unrenderpulse()
addEventHandler("onClientRender",root,renderPulse)
    setTimer( function ()
    removeEventHandler("onClientRender",root,renderPulse)
    end,8000,1)
end



Jest on odpowiedzialny za stworzenie dxdrawu(textu) na ekranie, kt?ry ja wpisz? po komendzie /draw, powinien on stworzy? si? w skali 0.1 i wjecha? na 3 i po 8 sekundkach znikn??, lecz pojawia si? na 1 klatke(FPS) i potem znika (gdy wpisze co? znowu to pojawia si? nieco wi?kszy i znowu znika i tak, a? gdy wbije mu skala 3.0) wiem, ?e pewnie co? nie tak jest z onclientrender, lecz ja ju? nie mam pomys?u gdzie go mog? wcisn??. Z g?ry dzi?ki za pomoc.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-01, 14:19


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Xaar, lepsze zastosowanie to
Więcej informacji znajdziesz w Wikipedii MTA:

InterpolateBetween


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-01, 14:20


Xaar







Wiek: 26
Na forum: 5591 dni
Posty: 47
Nick w MP: PLWESOLYKOSTEK

Piwa: 82

Respekt: 60

"luki123luki123" napisał/a:

Xaar, lepsze zastosowanie to
Więcej informacji znajdziesz w Wikipedii MTA:

InterpolateBetween

Pr?bowa?em z tym co? pokombinowa?, ale nie ogarniam tego, wiki za bardzo mi te? nie pomog?a ;/ Mo?e pom?g?by? mi to mniej wi?cej "zmieni?" na powy?sze zastosowanie? By?bym wdzi?czny.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-01, 14:25


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Xaar,
local defScale = 0.1 --min scale
local maxScale = 3 --max scale
mojeW,mojeH = 640, 480
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

local enabled = false
 
addCommandHandler("draw", function()
    enabled = not enabled
    if enabled then
        start = getTickCount()
        addEventHandler("onClientPreRender", root, interpolateCam)
        else
        start = nil
        removeEventHandler("onClientPreRender", root, interpolateCam)
    end
end)

 
function interpolateCam()
    local now = getTickCount()
    local endTime = start + 2000
    local elapsedTime = now - start
    local duration = endTime - start
    local progress = elapsedTime / duration
    local scale  = interpolateBetween ( defScale, 0, 0, maxScale, 0, 0, progress, "OutQuad")
   dxDrawText(tresc,300*width, 20*height, 560*width, 260*height,tocolor(255,255,255,255),scale,"default-bold","left","top",false,false,false,true)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-01, 14:34


Xaar







Wiek: 26
Na forum: 5591 dni
Posty: 47
Nick w MP: PLWESOLYKOSTEK

Piwa: 82

Respekt: 60

"luki123luki123" napisał/a:

Xaar,
local defScale = 0.1 --min scale
local maxScale = 3 --max scale
mojeW,mojeH = 640, 480
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

local enabled = false
 
addCommandHandler("draw", function()
    enabled = not enabled
    if enabled then
        start = getTickCount()
        addEventHandler("onClientPreRender", root, interpolateCam)
        else
        start = nil
        removeEventHandler("onClientPreRender", root, interpolateCam)
    end
end)

 
function interpolateCam()
    local now = getTickCount()
    local endTime = start + 2000
    local elapsedTime = now - start
    local duration = endTime - start
    local progress = elapsedTime / duration
    local scale  = interpolateBetween ( defScale, 0, 0, maxScale, 0, 0, progress, "OutQuad")
   dxDrawText(tresc,300*width, 20*height, 560*width, 260*height,tocolor(255,255,255,255),scale,"default-bold","left","top",false,false,false,true)
end


Nie dzia?a co?

local defScale = 0.1 --min scale
local maxScale = 3 --max scale
mojeW,mojeH = 640, 480
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

local enabled = false
 
addCommandHandler("draw", function(tresc)
   local tresc = table.concat({tresc}, " ")
   enabled = not enabled
    if enabled then
        start = getTickCount()
        addEventHandler("onClientPreRender", root, interpolateCam)
        else
        start = nil
        removeEventHandler("onClientPreRender", root, interpolateCam)
    end
end)

 
function interpolateCam()
    local now = getTickCount()
    local endTime = start + 2000
    local elapsedTime = now - start
    local duration = endTime - start
    local progress = elapsedTime / duration
    local scale  = interpolateBetween ( defScale, 0, 0, maxScale, 0, 0, progress, "OutQuad")
   dxDrawText(tresc,300*width, 20*height, 560*width, 260*height,tocolor(255,255,255,255),scale,"default-bold","left","top",false,false,false,true)
end
- Doda?em local tresc, ?eby po wpisaniu komendy mo?na by?o co? wpisa? :P w debugu 29 linijka(dxdrawtext) expected string at argument 1 got nil.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-01, 14:39


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Xaar, polecam nauczy? si? lua :)
local defScale = 0.1 --min scale
local maxScale = 3 --max scale
mojeW,mojeH = 640, 480
sW,sH = guiGetScreenSize()
width, height = (sW/mojeW), (sH/mojeH)

local enabled = false
 
addCommandHandler("draw", function(cmd, ...)
    local arg = {...}
  local tresc = table.concat(arg, " ")
   enabled = not enabled
    if enabled then
        start = getTickCount()
                value = tresc
        addEventHandler("onClientPreRender", root, interpolateCam)
        else
                value = ""
        start = nil
        removeEventHandler("onClientPreRender", root, interpolateCam)
    end
end)

 
function interpolateCam()
    local now = getTickCount()
    local endTime = start + 2000
    local elapsedTime = now - start
    local duration = endTime - start
    local progress = elapsedTime / duration
    local scale  = interpolateBetween ( defScale, 0, 0, maxScale, 0, 0, progress, "OutQuad")
   dxDrawText(value,300*width, 20*height, 560*width, 260*height,tocolor(255,255,255,255),scale,"default-bold","left","top",false,false,false,true)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-01, 14:41


Xaar







Wiek: 26
Na forum: 5591 dni
Posty: 47
Nick w MP: PLWESOLYKOSTEK

Piwa: 82

Respekt: 60

W?a?nie to robie :V dzi?kuj? bardzo.

Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: kłopot :: dxdrawtext
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Kłopot z dxdrawtext 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