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

Wysłany: 2017-11-16, 21:36


EvilXmik







Wiek: 28
Na forum: 3761 dni
Posty: 148
Nick w MP: EvilXmik

Piwa: 399

Respekt: 50

Witam mam problem z tym skryptem pr?buje go na sw?j serwer wstawi? ale wyskakuj? mi DB i nie wiem co mam zrobi? za pomoc stawiam :piwo:

DB w 10/28/40 linijce
S_side


local skrzyniaogloszen = createObject ( 980, 0,0, -100 )

function ogloszenie ( source, cmd, ... )
if not getElementData(source,"duty") then outputChatBox("*Brak uprawnien",source,255,0,0) return end
    if ... then
        if not getElementData ( skrzyniaogloszen, "ogloszenie" ) then
            local text = table.concat({...}, " " )
            setElementData ( skrzyniaogloszen, "ogloszenie", true )
            setElementData ( skrzyniaogloszen, "tekstogloszenia","(Admin) "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." ( "..getElementData ( source, "id").." ) : \n "..text.." ")
            setTimer ( setElementData, 10000,1, skrzyniaogloszen, "ogloszenie", false )
        else
            outputChatBox("Og?oszenia mog? by? nadawane minimum 10 sekund.", source, 255, 96, 0, true ) 

        end
    else
        outputChatBox("Aby nada? og?oszenie  /ogloszenie [tresc] .", source, 255, 96, 0, true ) 
    end
end
addCommandHandler("ogloszenie", ogloszenie)



c_side (tu s? b??dy)

local start = getTickCount()
function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
    if 
        type( sEventName ) == 'string' and 
        isElement( pElementAttachedTo ) and 
        type( func ) == 'function' 
    then
        local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
        if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
            for i, v in ipairs( aAttachedFunctions ) do
                if v == func then
                    return true
                end
            end
        end
    end
 
    return false
end

function hud()
x,y = guiGetScreenSize()
screenW,screenH = guiGetScreenSize()
 for k,v in ipairs ( getElementsByType ( "object" ) ) do
    if getElementData ( v, "ogloszenie" ) then
        local tekst = getElementData ( v, "tekstogloszenia" )
        local width = dxGetTextWidth(tekst,1,"Arial")
        local now = getTickCount()
            local endTime = start + 2000
        local elapsedTime = now - start
        local duration = endTime - start

        local progress = elapsedTime / duration
        if progress and progress > 4 then
        if not s then
        s = getTickCount()
        end
        local x, y, z = interpolateBetween (screenW * 0.0022, screenH * 0.5226, 0, screenW * 1.2, screenH * 0.5226 , 0, (s-getTickCount())/(( s + 2000 ) - s ), "InOutBack")
        dxDrawRectangle(x, y, screenW * 0.2500 , screenH * 0.0365 + (width * 0.05), tocolor(0, 0, 0, 151), false)
        dxDrawText(tekst,x, y, screenW * 0.2522, screenH * 0.0391, tocolor(255, 255, 255, 255), 1.00, "default", "center", "top", false, true, false, false, false)
        return end
        local px, py, pz = getElementPosition(localPlayer)
        local x, y, z = interpolateBetween ( screenW * -0.2, screenH * 0.5226, 0,screenW * 0.0022, screenH * 0.5226 , 0, progress, "InOutBack")

        dxDrawRectangle(x, y, screenW * 0.2500 , screenH * 0.0365 + (width * 0.05), tocolor(0, 0, 0, 151), false)
        dxDrawText(tekst,x, y, screenW * 0.2522, screenH * 0.0391, tocolor(255, 255, 255, 255), 1.00, "default", "center", "top", false, true, false, false, false)
    end
end
end

addEventHandler ( "onClientElementDataChange", root, function(data,old)
    if getElementType(source) == "object" and data == "ogloszenie" then
        if getElementData(source,"ogloszenie") then
            if isEventHandlerAdded("onClientRender",root,hud) then
                removeEventHandler ( "onClientRender", root, hud)
            end
            start = getTickCount()
            s = nil
            addEventHandler ( "onClientRender", root, hud)
        else
            removeEventHandler ( "onClientRender", root, hud)
            start = getTickCount()
            s = nil
        end
    end
end)
addEventHandler ( "onClientRender", root, hud)


Komentarz marcin778 dodany 2017-11-17, 13:39Tagi [lua][/lua] są czytelniejsze i ich używaj - większe szanse na pomoc.
Ostatnio zmieniony przez marcin778 2017-11-17, 13:39, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-17, 15:52


Pevo

Jabłko






Wiek: 24
Na forum: 3731 dni
Posty: 356
Nick w MP: Pevo

Piwa: 1578

Respekt: 355,8
Respekt: 355,8Respekt: 355,8Respekt: 355,8Respekt: 355,8

Nikt nie jest jasnowidzem. Podanie numeru linijki nie wystarczy tym bardziej jak nie dajesz pe?nego kodu. Zaznacz dok?adne linijki, w kt?rych jest b??d

Podpis
Jabłko
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-17, 16:32


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

EvilXmik, podaj najlepiej ss z b??d?w i dok?adne linijki

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: ogłoszeniach
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » DB w ogłoszeniach 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