Jump to content

HELP ME


Recommended Posts

 

Hello everyone there is an infobox scrip-t, but I do not know it unfortunately that if I write it in that /cv announces it above then that you created a vehicle successfully with what I do not know it somebody knows about where it is necessary to invite it to help?
 

The 2. I would like it if somebody who kickelek, you are kibannolok issues it with a sick-note then
Ban"(Admin) who tíltotta (player) from the server
Kick"(Admin) who fired it from the server (player)

HUNGARY

Sziasztok van egy infobox scrip-t, de sajnos nem tudom hogy ha beírom hogy /cv akkor azt írja ki felül hogy "Sikeresen Létrehoztál egy járművet" mivel nem tudom hogy hol kell meghívni, valaki tud segíteni?

2. Meg azt szeretném ha valakit ki kickelek, vagy kibannolok akkor azt írja ki

Ban"(Admin) ki tíltotta (játékost) a szerverről"
Kick"(Admin) ki kirúgta a szerverről (játékost)

SCRIPT

local screen = {}
screen.x, screen.y = guiGetScreenSize()
local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}


local itypes = {
    alert = "alert.png",
    info = "info.png",
    success = "success.png",
    warning = "warning.png",
    ban = "ban.png",
}

local itypes2 = {"alert","info","success","warning","ban"}

local font = dxCreateFont("helveticaneue.otf",10)

local messages = {}

local infobox = {}
infobox.w = 200
infobox.h = 33
infobox.y = 10
infobox.x = screen.x/2 - infobox.w/2


function createInfoBox(message,itype)
    local id = #messages+1
    table.insert(messages,id,{
        id = id,
        message = message,
        itype = itype,
        x = infobox.x,
        y = infobox.y,
        w = infobox.h,
        h = infobox.h,
        dWidth = infobox.h + dxGetTextWidth(message,1,font) + 10,
        opacity = 0, -- 0-1 eső érték
        animState = false,
        })

    createAnimation(0,1,4,300,function(animation) messages[id].opacity = animation end,function()
        createAnimation(infobox.h,messages[id].dWidth,4,300,function(animation) messages[id].w = animation end,function()
            setTimer(function()
                createAnimation(messages[id].dWidth,infobox.h,4,300,function(animation) messages[id].w = animation end,function()
                    createAnimation(1,0,4,300,function(animation) messages[id].opacity = animation end,function()
                        messages[id] = nil
                    end)
                end)
            end,2000,1)
        end)
    end)
end

function renderInfoBox()
    local i = 0
    for _,v in pairs(messages) do
        v.x = screen.x/2 - v.w/2
        -- Szöveg háttere
        dxDrawRectangle(v.x,v.y + i*v.h + i*10,v.w,v.h,tocolor(0,0,0,170*v.opacity))
        -- Ikon háttere
        dxDrawRectangle(v.x,v.y + i*v.h + i*10,v.h,v.h,tocolor(0,0,0,170*v.opacity))
        --
        dxDrawImage(v.x + v.h/2 - (v.h-10)/2,v.y + i*v.h + i*10 + v.h/2 - (v.h-10)/2,v.h - 10,v.h - 10,itypes[v.itype],0,0,0,tocolor(255,255,255,255*v.opacity))

        -- Szöveg
        dxDrawText(v.message,
            v.x + v.h + 5,
            v.y + i*v.h + i*10 + v.h/2 - dxGetFontHeight(1,font)/2,
            v.x+v.w,
            v.y + i*v.h + i*10 +v.h,
            tocolor(255,255,255,255*v.opacity),1,font,"left","top",true)

        i = i + 1
    end
end
addEventHandler("onClientRender",root,renderInfoBox)


function table.find(t, v)
    for k, a in ipairs(t) do
        if a == v then
            return k
        end
    end
    return false
end

function createAnimation(f, t, easing, duration, onChange, onEnd)
    assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
    assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
    assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
    assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
    assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
    table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
    return #anims
end

function destroyAnimation(a)
    if anims[a] then
        table.remove(anims, a)
    end
end

addEventHandler("onClientRender", root, function( )
    local now = getTickCount( )
    for k,v in ipairs(anims) do
        v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
        if now >= v.start+v.duration then
            if type(v.onEnd) == "function" then
                v.onEnd( )
            end
            table.remove(anims, k)
        end
    end
end)
        
        createInfoBox("!!!!!!!KICK/BAN!!!!!!!!","info")

 

Link to comment
  • Moderators

HUNGARIAN

- Elsőnek is. A kód az működik? -> Ha elindítod az infobox resourcet, akkor megjelenik a "!!!!!!!KICK/BAN!!!!!!!!" infó?

- Ha nem, akkor több gond is van.

 

- Ha igen, akkor elsőnek is másold be ezt a fájl végére: [createInfoBox("!!!!!!!KICK/BAN!!!!!!!!","info") sorok helyére, lényegében]

addEvent("createInfoBox", true)
addEventHandler("createInfoBox", root, createInfoBox)

 

Ezután fogod tudni meghívni más resourceokból triggerEvent, vagy triggerClientEvent -el.

 

Ha CLIENT oldalról szeretnéd meghívni, akkor így teheted meg:

-- Ezt akkor tudod használni, ha például client oldalon tesz valamit a player és infót akarsz adni neki róla, de természetesen ezt csak ő fogja látni.

triggerEvent("createInfoBox", localPlayer, "SZÖVEG", "info")

 

Ha SERVER oldalról szeretnéd meghívni, akkor így teheted meg:

-- Ezt akkor tudod használni, ha például server oldalon tesz valamit egy player és MINDENKINEK el akarod küldeni.

triggerClientEvent(root, "createInfoBox", root, "SZÖVEG", "info")

 

Link to comment
  • Moderators
6 hours ago, ChrisT said:

Szia, működik az infobox természetesen, server oldalról szeretném megnyitni, de úgy ha beírom hogy /kick vagy /ban. Ahoz még irni kell addCommandHandler-t nem?

 

HUNGARIAN

Természetesen, lennie kell valahol egy /kick és egy /ban funkciónak már, ha működnek a parancsok.

Link to comment

Szia @stPatrick most elkezdtem újra evvel foglalkozni

mivel ennek az infobox scriptnek csak 1 client mappája és egy meta és pár kép van ami az infobox elején van

Quote

addEventHandler("onClientRender", root, function( )
    local now = getTickCount( )
    for k,v in ipairs(anims) do
        v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
        if now >= v.start+v.duration then
            if type(v.onEnd) == "function" then
                v.onEnd( )
            end
            table.remove(anims, k)
        end
    end
end)
        
AMI FELÜL VAN AZ AZ INFOBOX ALAP RÉSZE,   AMI ALUL AZT MÁR ÉN RAKTAM ODA        


function createVcle(sourcePlayer, commandName, ...)
local x,y,z = getElementPosition(sourcePlayer)
local vehicleName = table.concat({...}, " ")
local vehicleID = getVehicleModelFromName ( vehicleName )
createVehicle( vehicleID, x + 5, y + 5, z + 5 )
end


addEvent("createInfoBox", true)
addEventHandler("createInfoBox", root, createInfoBox)

van egy scriptem ami /mv parancson fut ekkor lehívja az adott kocsit pl: /mv Admiral

és akkor ezt raktam az infobox végére, és nem jó nem irja ki

                       

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...