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

Wysłany: 2017-01-04, 18:41


MartinPanZycia

Zielony w LUA






Wiek: 27
Na forum: 3728 dni
Posty: 476
Nick w MP: Rodzaje

Piwa: 878

Respekt: 70,5

Ostrzeżeń: 40%
Siemanko , ot?? jestem zielony w tym i mam problem , macie pewnie podstawowy killmesages wiec kodu nie musze podawac , chodzi oto ze u mnie jest tak
,?e jak kto? kogo? zabije t owidac mu np. #ff0000Nick zabi? Gracza3232
Co chce zrobi? no chce aby Ten nick , nie mia? tego wiecie napisu kolorku tylko mia? ten kolorek tam : D
jak kto? nie rozumie to powtorze
#ff0000Nick zabi? Gracza3232
Jak jest
Nick zabi? Gracza3232
a jak ma by?

kolorek podalem losowy jako przyklad ale wiecie o co chodzi

Myslalem ze sam to zrobie ale nie mog znalesc nigdzie cos co odpowiada za wyswietlanie aby to moglem jakos zmodyfikowac
szukalem w killmesages_client

addEvent ("onClientPlayerKillMessage",true)
function onClientPlayerKillMessage killer,weapon,wr,wg,wb,kr,kg,kb,width,resource )
    if wasEventCancelled() then return end
    outputKillMessage sourcewr,wg,wb,killer,kr,kg,kb,weapon,width,resource )
end
addEventHandler ("onClientPlayerKillMessage",getRootElement(),onClientPlayerKillMessage)

function outputKillMessage sourcewr,wg,wb,killer,kr,kg,kb,weapon,width,resource )
    if not iconWidths[weaponthen 
        if type(weapon) ~= "string" then
            weapon 999 
        end
    end
    local killerName
    local wastedName
    if not tonumber(wrthen wr 255 end
    if not tonumber(wgthen wg 255 end
    if not tonumber(wbthen wb 255 end
    if not tonumber(krthen kr 255 end
    if not tonumber(kgthen kg 255 end
    if not tonumber(kbthen kb 255 end
    if ( source then
        if isElement source then
            if getElementType source ) == "player" then 
                wastedName getPlayerName source )
            else 
            outputDebugString "outputKillMessage - Invalid 'wasted' player specified",0,0,0,100)
            return false end
        elseif type(source) == "string" then
            wastedName source
        end
    else 
        outputDebugString "outputKillMessage - Invalid 'wasted' player specified",0,0,0,100)
    return false end
    if ( killer then
        if isElement killer then
            if getElementType killer ) == "player" then
                killerName getPlayerName killer )
            else 
                outputDebugString "outputKillMessage - Invalid 'killer' player specified",0,0,0,100)
            return false end
        elseif type(killer) == "string" then
            killerName killer
        else
            killerName ""
        end
    else killerName "" end
    --create the new text
    if not killerName then
        killerName ""
    end
    return outputMessage ( {killerName, {"padding",width=3}, {"icon",id=weapon},
        {"padding",width=3},{"color",r=wr,g=wg,b=wb}, wastedName},
        kr,kg,kb )
end

i to chyba to bo najlepiej mi pasowalo ale nwm co ruszy? aby dzia?a?o jak chce

Teamat my?le ,?e b?achy i jestem otwarty na wsp??prace jakby komu? zale?y na pomocy a nie na wy?mianiu mnie ,ze za?miecam forum

Podpis
Cześć w MTA jestem jako Rodzaje.
Wszystko jest po staremu nie zamierzam stawiać RPG.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-04, 19:06


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

MartinPanZycia, Zapewne je?li jest to outputChatBox to musisz da? ostatni argument na true. Niestety tutaj nie widz? nic takiego. Na ko?cu masz return outputMessage musisz zobaczy? jak si? ta funkcja nazywa i j? poda?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-04, 19:22


MartinPanZycia

Zielony w LUA






Wiek: 27
Na forum: 3728 dni
Posty: 476
Nick w MP: Rodzaje

Piwa: 878

Respekt: 70,5

Ostrzeżeń: 40%

function outputMessage messagevisibleTorgbfont )
    if type(message) ~= "string" and type(message) ~= "table" then
        outputDebugString "outputMessage - Bad 'message' argument"0112112112 ) 
        return false 
    end
    if not isElement(visibleTothen 
        outputDebugString "outputMessage - Bad argument"0112112112 ) 
        return false 
    end
    --Turn any resources into resource names
    if type(message) == "table" then
        for i,part in ipairs(message) do
            if type(part) == "table" and part[1] == "image" then
                if part.resource then
                    message[i].resourceName getResourceName(part.resource)
                else
                    part.resourceName getResourceName(sourceResource)
                end
            end
        end
    end
    return triggerClientEvent visibleTo"doOutputMessage"visibleTomessagergbfont )
end

Mam to i gdzie tu by zmieni? ?czy mam szuka? doOutputMessage ?

[ Dodano: 2017-01-04, 20:26 ]
Ziomek no pomusz m?wi?e? co? o ostatnim argumencie na true
wchodzi o to ?

dxText = {}
dxText_mt = { __index dxText }
local idAssign,idPrefix 0,"c"
local g_screenX,g_screenY guiGetScreenSize()
local visibleText = {}
------
local defaults = {
    fX                            0.5,
    fY                            0.5,
    bRelativePosition            true,
    strText                        "",
    bVerticalAlign                 "center",
    bHorizontalAlign             "center",
    tColor                         = {255,255,255,255},
    fScale                         1,
    strFont                     "default",
    strType                        "normal",
    tAttributes                    = {},
    bPostGUI                     false,
    bClip                         false,
    bWordWrap                     true,
    bVisible                     true,
    tBoundingBox                false, --If a bounding box is not setit will not be used.
    bRelativeBoundingBox        true,
}

local validFonts = {
    default                        = true,
    ["default-bold"]            = true,
    clear                        true,
    arial                        true,
    pricedown                    true,
    bankgothic                    true,
    diploma                        true,
    beckett                        true,
}

local validTypes = {
    normal                        true,
    shadow                        true,
    border                        true,
    stroke                        true, --Clone of border
}

local validAlignTypes = {
    center                        true,
    left                        true,
    right                        true,
}

function dxText:createtextxyrelative )
    assert(not self.fX"attempt to call method 'create' (a nil value)")
    if ( type(text) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then
        outputDebugString "dxText:create - Bad argument"0112112112 )
        return false
    end
    local new = {}
    setmetatable( new, dxText_mt )
    --Add default settings
    for i,v in pairs(defaults) do
        new[i] = v
    end
    idAssign idAssign 1
    new.id idPrefix..idAssign
    new.strText text or new.strText
    new.fX or new.fX
    new.fY or new.fY
    if type(relative) == "boolean" then
        new.bRelativePosition relative
    end
    visibleText[new] = true
    return new
end

function dxText:text(text)
    if type(text) ~= "string" then return self.strText end
    self.strText text
    return true
end

function dxText:position(x,y,relative)
    if not tonumber(xthen return self.fXself.fY end
    self.fX x
    self.fY y
    if type(relative) == "boolean" then
        self.bRelativePosition relative
    else
        self.bRelativePosition true
    end
    return true
end

function dxText:color(r,g,b,a)
    if not tonumber(rthen return unpack(self.tColorend
    g or self.tColor[2]
    or self.tColor[3]
    or self.tColor[4]
    self.tColor = { r,g,b,}
    return true
end

function dxText:scale(scale)
    if not tonumber(scalethen return self.fScale end
    self.fScale scale
    return true
end

function dxText:visible(bool)
    if type(bool) ~= "boolean" then return self.bVisible end
    self.bVisible bool
    if bool then
        visibleText[self] = true
    else
        visibleText[self] = nil
    end
    return true
end

function dxText:destroy()
    self.bDestroyed true
    setmetatableselfself )
    return true
end

function dxText:extent()
    local extent dxGetTextWidth self.strTextself.fScaleself.strFont )
    if self.strType == "stroke" or self.strType == "border" then
        extent extent self.tAttributes[1]
    end
    return extent
end

function dxText:height()
    local height dxGetFontHeight self.fScaleself.strFont )
    if self.strType == "stroke" or self.strType == "border" then
        height height self.tAttributes[1]
    end
    return height
end

function dxText:font(font)
    if not validFonts[fontthen return self.strFont end
    self.strFont font
    return true
end

function dxText:postGUI(bool)
    if type(bool) ~= "boolean" then return self.bPostGUI end
    self.bPostGUI bool
    return true
end

function dxText:clip(bool)
    if type(bool) ~= "boolean" then return self.bClip end
    self.bClip bool
    return true
end

function dxText:wordWrap(bool)
    if type(bool) ~= "boolean" then return self.bWordWrap end
    self.bWordWrap bool
    return true
end

function dxText:type(type,...)
    if not validTypes[typethen return self.strTypeunpack(self.tAttributesend
    self.strType type
    self.tAttributes = {...}
    return true
end

function dxText:align(horzAvertA)
    if not validAlignTypes[horzAthen return self.bHorizontalAlignself.bVerticalAlign end
    vertA vertA or self.bVerticalAlign
    self.bHorizontalAlignself.bVerticalAlign horzAvertA
    return true
end

function dxText:boundingBox(left,top,right,bottom,relative)
    if left == nil then
        if self.tBoundingBox then
            return unpack(boundingBox)
        else
            return false
        end
    elseif tonumber(left) and tonumber(right) and tonumber(top) and tonumber(bottomthen
        self.tBoundingBox = {left,top,right,bottom}
        if type(relative) == "boolean" then
            self.bRelativeBoundingBox relative
        else
            self.bRelativeBoundingBox true
        end
    else
        self.tBoundingBox false
    end
    return true
end

addEventHandler "onClientRender"getRootElement(),
    function()
        for self,_ in pairs(visibleText) do
            while true do
                if self.bDestroyed then
                    visibleText[self] = nil
                    break
                end
                local l,t,r,b
                --If we arent using a bounding box
                if not self.tBoundingBox then
                    --Decide if we use relative or absolute
                    local p_screenX,p_screenY 1,1
                    if self.bRelativePosition then
                        p_screenX,p_screenY g_screenX,g_screenY
                    end
                    local fX,fY = (self.fX)*p_screenX,(self.fY)*p_screenY
                    if self.bHorizontalAlign == "left" then
                        l fX
                        r fX g_screenX
                    elseif self.bHorizontalAlign == "right" then
                        l fX g_screenX
                        r fX
                    else
                        fX g_screenX
                        r fX g_screenX
                    end
                    if self.bVerticalAlign == "top" then
                        t fY
                        b fY g_screenY
                    elseif self.bVerticalAlign == "bottom" then
                        t fY g_screenY
                        b fY
                    else
                        fY g_screenY
                        b fY g_screenY
                    end
                elseif type(self.tBoundingBox) == "table" then
                    local b_screenX,b_screenY 1,1
                    if self.bRelativeBoundingBox then
                        b_screenX,b_screenY g_screenX,g_screenY
                    end
                    l,t,r,self.tBoundingBox[1],self.tBoundingBox[2],self.tBoundingBox[3],self.tBoundingBox[4]
                    l*b_screenX
                    t t*b_screenY
                    r r*b_screenX
                    b b*b_screenY
                end
                local type,att1,att2,att3,att4,att5 self:type()
                if type == "border" or type == "stroke" then
                    att2 att2 or 0
                    att3 att3 or 0
                    att4 att4 or 0
                    att5 att5 or self.tColor[4]
                    outlinesize att1 or 2
                    outlinesize math.min(self.fScale,outlinesize) --Make sure the outline size isnt thicker than the size of the label
                    if outlinesize 0 then
                        for offsetX=-outlinesize,outlinesize,outlinesize do
                            for offsetY=-outlinesize,outlinesize,outlinesize do
                                if not (offsetX == and offsetY == 0then
                                    dxDrawText(self.strTextoffsetXoffsetYoffsetXoffsetYtocolor(att2att3att4att5), self.fScaleself.strFontself.bHorizontalAlignself.bVerticalAlignself.bClipself.bWordWrapself.bPostGUI )
                                end
                            end
                        end
                    end
                elseif type == "shadow" then
                    local shadowDist att1
                    att2 att2 or 0
                    att3 att3 or 0
                    att4 att4 or 0
                    att5 att5 or self.tColor[4]
                    dxDrawText(self.strTextshadowDistshadowDistshadowDistshadowDisttocolor(att2att3att4att5), self.fScaleself.strFontself.bHorizontalAlignself.bVerticalAlignself.bClipself.bWordWrapself.bPostGUI )
                end
                dxDrawText self.strTextltrbtocolor(unpack(self.tColor)), self.fScaleself.strFontself.bHorizontalAlignself.bVerticalAlignself.bClipself.bWordWrapself.bPostGUI )
                break
            end
        end
    end
)

if addEvent "updateDisplays"true then
    addEventHandler "updateDisplays"getRootElement(),
        function(self)
            setmetatableselfdxText_mt )
            --Remove any old ones with the same id
            for text,_ in pairs(visibleText) do
                if text.id == self.id then
                    visibleText[text] = nil
                end
            end
            if self.bVisible and not self.bDestroyed then
                visibleText[self] = true
            end
        end
    )
end


Podpis
Cześć w MTA jestem jako Rodzaje.
Wszystko jest po staremu nie zamierzam stawiać RPG.
Postaw piwo autorowi tego posta
 

 
Tagi: kolor :: nicku :: skrypcie :: killmesages
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » kolor nicku w skrypcie killmesages 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