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

Wysłany: 2016-05-23, 08:51


Odważny

Początki LUA :P






Wiek: 26
Na forum: 3880 dni
Posty: 140
Nick w MP: ReseT_

Piwa: 166

Respekt: 50

witam, chc? ?eby m?j skrypt na logi serwerowe po lewej stronie wy?wietla? logi z mojego czatu

oto kod mojego czatu g??wnego:

addEventHandler("onPlayerChat", root, function(tresc, msgtype)
    if (msgtype == 0) then
        cancelEvent()
        local x,y,z = getElementPosition(source)
        for key, gracze in ipairs(getElementsByType("player")) do
            local x2,y2,z2 = getElementPosition(gracze)
            if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<50) then
                local int = getElementInterior(source)
                local dim = getElementDimension(source)
                local int2 = getElementInterior(gracze)
                local dim2 = getElementDimension(gracze)
                local id = getElementData(source, "id")
                if (int == int2 and dim == dim2) then
                    outputChatBox("#00FF1A[#ffffff"..getElementData(source,"id").."#00FF1A] #ffffff".. getPlayerName(source) ..": #ffffff".. tresc, gracze, 255, 255, 255, true)
                end
            end
        end
    end
end)


a oto kod na logi serwerowe(chc? zeby pisa?o po lewej stronie pod napisem Logi serwerowe ?eby pisa?o kto co pisze):



local xtext=nil
local gameView={"Logi serwerowe:"}
local reportView={"Lista raport?w:"}
local sx,sy=guiGetScreenSize()

addEventHandler("onClientRender", root, function()
    if not getElementData(localPlayer,"administracjaduty") then return end
    concat=table.concat(gameView, "\n")
    dxDrawText(concat, sx*(10+1)/1024, sy*(279+1)/768, sx*(326+1)/1024, sy*(497+1)/768, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, true)
    dxDrawText(concat, sx*(10)/1024, sy*(279)/768, sx*(326)/1024, sy*(497)/768, white, 1.00, "default-bold", "left", "top", false, true)
end)

function renderingInfo()
dxDrawRectangle(sx*(258)/1024, sy*(0)/768, sx*(500)/1024, sy*(23)/768, tocolor(0, 0, 0, 155), false)
    dxDrawText(xtext, sx*(258+1)/1024, sy*(0+1)/768, sx*(758+1)/1024, sy*(23+1)/768, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, true)
    dxDrawText(xtext, sx*(258)/1024, sy*(0)/768, sx*(758)/1024, sy*(23)/768, tocolor(255, 0, 0, 255), 1.00, "default-bold", "center", "center", false, true)
end

addEventHandler("onClientRender", root, function()
    if not getElementData(localPlayer,"administracjaduty") then return end
    local tt={}
    for i,v in ipairs(reportView) do
        if v[1] then table.insert(tt,v[1]) end
    end
    concat=table.concat(tt, "\n")
    dxDrawText(concat, sx*(698+1)/1024, sy*(278+1)/768, sx*(1014+1)/1024, sy*(496+1)/768, tocolor(0, 0, 0, 255), 1.00, "default-bold", "right", "top", false, true)
    dxDrawText(concat, sx*(698)/1024, sy*(278)/768, sx*(1014)/1024, sy*(496)/768, tocolor(255, 255, 255, 255), 1.00, "default-bold", "right", "top", false, true)
end)

addEvent("onPlayerChat", true)
addEventHandler("onPlayerChat", root, function(text)
    table.insert(gameView, text)    
    if #gameView > 10 then
        table.remove(gameView, 1)
    end
end)

addEvent("admin:addRaport", true)
addEventHandler("admin:addRaport", root, function(text,id)
    table.insert(reportView, {text,id})
    if #reportView > 10 then
        table.remove(reportView, 1)
    end
end)

addEvent("admin:removeRaport", true)
addEventHandler("admin:removeRaport", root, function(id)
    for i=#reportView, 1, -1 do
        if reportView[i][2] == id then
            table.remove(reportView,i)
        end
    end
end)

addEvent("admin:rendering", true)
addEventHandler("admin:rendering", root, function(text)
    xtext=text
    addEventHandler("onClientRender", root, renderingInfo)
    setTimer(function()
        removeEventHandler("onClientRender", root, renderingInfo)
    end, 5000, 1)
end)


Podpis
, pomogłem Ci? Wynagrodź mnie :piwo: :P
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-23, 16:07


_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%
Dodaj do skryptu na czat triggera

triggerClientEvent("onPlayerChat",localPlayer,tresc)


Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Tagi: logi :: serwerowe
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