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: 3756 dni
Posty: 222

Piwa: 2294

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 kv in ipairs(getElementsByType("vehicle")) do
if (getElementModel(v)==407then
dt dxDrawTextOnElement(v,"test",1,20,30,30,30,255,1,"default")
end
end
addEventHandler("onClientResourceStart"rootmytext)

function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)
                local xygetElementPosition(TheElement)
                local x2y2z2 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(xyzx2y2z2checkBuildingscheckVehiclescheckPeds checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sxsy getScreenFromWorldPosition(xyz+height)
                    if(sx) and (sythen
                        local distanceBetweenPoints getDistanceBetweenPoints3D(xyzx2y2z2)
                        if(distanceBetweenPoints distancethen
                            dxDrawText(textsx+2sy+2sxsytocolor(or 255or 255or 255alpha 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: 3881 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: 3756 dni
Posty: 222

Piwa: 2294

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 xygetElementPosition(TheElement)
                local x2y2z2 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(xyzx2y2z2checkBuildingscheckVehiclescheckPeds checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sxsy getScreenFromWorldPosition(xyz+height)
                    if(sx) and (sythen
                        local distanceBetweenPoints getDistanceBetweenPoints3D(xyzx2y2z2)
                        if(distanceBetweenPoints distancethen
                            dxDrawText(textsx+2sy+2sxsytocolor(or 255or 255or 255alpha or 255), (size or 1)-(distanceBetweenPoints distance), font or "arial""center""center")
            end
        end
    end
end

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


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: 3881 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"falsefalsefalsefalsefalsefalsefalsefalse)


Postaw piwo autorowi tego posta
 

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


noose

JESTĘ SKRYPTERĘ






Wiek: 35
Na forum: 3756 dni
Posty: 222

Piwa: 2294

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 xygetElementPosition(TheElement)
                local x2y2z2 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(xyzx2y2z2checkBuildingscheckVehiclescheckPeds checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sxsy getScreenFromWorldPosition(xyz+height)
                    if(sx) and (sythen
                        local distanceBetweenPoints getDistanceBetweenPoints3D(xyzx2y2z2)
                        if(distanceBetweenPoints distancethen
                            dxDrawText(textsx+2sy+2sxsytocolor(or 255or 255or 255alpha or 255), (size or 1)-(distanceBetweenPoints distance), font or "arial""center""center")
            end
        end
    end
end

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


Postaw piwo autorowi tego posta
 

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


_Wicek_

Majstersztyk






Wiek: 25
Na forum: 4260 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1841

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: 3756 dni
Posty: 222

Piwa: 2294

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