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

Wysłany: 2016-07-09, 23:50


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

Siemson;) Nie wiem co robi? ?le, dlatego udaj? si? po pomoc do Was. Mam pojazdy w server.lua, i chc? po stronie klienckiej doda? dla nich tekst(bo ta funkcja dzia?a tylko po stronie klienta(chyba). No i stworzy?em taki kod, tylko nie dzia?a :P Jakie? rady kto?? ;>

function mytext()
for k, v in ipairs(getElementsByType("vehicle")) do
if (getElementModel(v)==407) then
dt = dxDrawTextOnElement(v,"test",1,20,30,30,30,255,1,"default")
end
end
addEventHandler("onClientResourceStart", root, mytext)

function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)
                local x, y, z = getElementPosition(TheElement)
                local x2, y2, z2 = getElementPosition(localPlayer)
                local distance = distance or 20
                local height = height or 1
                                local checkBuildings = checkBuildings or true
                                local checkVehicles = checkVehicles or false
                                local checkPeds = checkPeds or false
                                local checkObjects = checkObjects or true
                                local checkDummies = checkDummies or true
                                local seeThroughStuff = seeThroughStuff or false
                                local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
                                local ignoredElement = ignoredElement or nil
                if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sx, sy = getScreenFromWorldPosition(x, y, z+height)
                    if(sx) and (sy) then
                        local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
                        if(distanceBetweenPoints < distance) then
                            dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center")
            end
        end
    end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-10, 00:18


GabWas







Wiek: 24
Na forum: 4022 dni
Posty: 289
Nick w MP: GabWas

Piwa: 65

Respekt: 231,5
Respekt: 231,5Respekt: 231,5

Zamie? kolejno?? funkcji.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-10, 00:25


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)
                local x, y, z = getElementPosition(TheElement)
                local x2, y2, z2 = getElementPosition(localPlayer)
                local distance = distance or 20
                local height = height or 1
                                local checkBuildings = checkBuildings or true
                                local checkVehicles = checkVehicles or false
                                local checkPeds = checkPeds or false
                                local checkObjects = checkObjects or true
                                local checkDummies = checkDummies or true
                                local seeThroughStuff = seeThroughStuff or false
                                local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
                                local ignoredElement = ignoredElement or nil
                if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sx, sy = getScreenFromWorldPosition(x, y, z+height)
                    if(sx) and (sy) then
                        local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
                        if(distanceBetweenPoints < distance) then
                            dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center")
            end
        end
    end
end

function mytext()
for k, v in ipairs(getElementsByType("vehicle")) do
if (getElementModel(v)==407) then
dt = dxDrawTextOnElement(v,"test",1,20,30,30,30,255,1,"default")
end
end
addEventHandler("onClientResourceStart", root, mytext)


Zrobi?em,przyjacielu, tak jak pisa?e?, i nie dzia?a niestety.

Kliknij, aby powiększyć.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-10, 00:33


GabWas







Wiek: 24
Na forum: 4022 dni
Posty: 289
Nick w MP: GabWas

Piwa: 65

Respekt: 231,5
Respekt: 231,5Respekt: 231,5

B??d?w w DB nie widz? (przynajmniej od tych funkcji), spr?buj takiej zmiennej:
dt = dxDrawTextOnElement(v,"test",1,20,30,30,30,255,1,"default", false, false, false, false, false, false, false, false)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-10, 01:03


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

Ok, ?eby by?o wyra?niej, powi?kszy?em tekst i da?em niebieski kolor, i wiesz co? Tekst pojawia si? na u?amek sekundy, po czym znika.

[ Dodano: 2016-07-10, 00:58 ]
Jednak jest co? ?le, wyci?g z db3
http://imgur.com/fdVnNq5

kod
function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)
                local x, y, z = getElementPosition(TheElement)
                local x2, y2, z2 = getElementPosition(localPlayer)
                local distance = distance or 20
                local height = height or 1
                                local checkBuildings = checkBuildings or true
                                local checkVehicles = checkVehicles or false
                                local checkPeds = checkPeds or false
                                local checkObjects = checkObjects or true
                                local checkDummies = checkDummies or true
                                local seeThroughStuff = seeThroughStuff or false
                                local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
                                local ignoredElement = ignoredElement or nil
                if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sx, sy = getScreenFromWorldPosition(x, y, z+height)
                    if(sx) and (sy) then
                        local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
                        if(distanceBetweenPoints < distance) then
                            dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center")
            end
        end
    end
end

function mytext()
for k, v in ipairs(getElementsByType("vehicle")) do
if (getElementModel(v)==407) then
dt = dxDrawTextOnElement(v,"test",1,20,0,0,255,255,5,"default", false, false, false, false, false, false, false, false)
end
end
end
addEventHandler("onClientResourceStart", root, mytext)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-10, 01:06


_Wicek_

Majstersztyk






Wiek: 26
Na forum: 4401 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1842

Respekt: 360,5
Respekt: 360,5Respekt: 360,5Respekt: 360,5Respekt: 360,5

Ostrzeżeń: 40%
Wszystkie dxDraw`y musz? by? podpi?te pod Event


Więcej informacji znajdziesz w Wikipedii MTA:

onClientRender


Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-10, 01:13


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3897 dni
Posty: 219

Piwa: 2295

Respekt: 155,8
Respekt: 155,8Respekt: 155,8

_Wicek_, Tw?j tytu? pod nickiem m?wi wszystko. Dzi?kuje Ci :)
Do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: drawtextonelement
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