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

Wysłany: 2017-01-19, 15:38


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

mam autorski skrypt na bany lecz nie dzia?a prosz? o pomoc

serwer

function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end



addCommandHandler ( "zbanuj", function ( plr, cmd, gracz, czas, rodzaj, cel, ... )
     local login = getAccountName ( getPlayerAccount ( plr ) )
    if sprawdzRoota(login) or sprawdzAdmina(login) or sprawdzModeratora(login) then
    if cel then
    player = getPlayerFromName(gracz)
    if not player then return end
    tresc = table.concat ( {...}, " " )
                    local nick = getPlayerName(plr)
                    local cel = getPlayerName(gracz)
                    local co = " zosta? zbanowany/a "
                    triggerClientEvent("info",resourceRoot,root,nickcel,nick,co,tresc)
    if rodzaj == "m" then
        rodzaj = "minut"
        czas1 = czas * 60
    else if rodzaj == "d" then
        rodzaj = "dni"
        czas1 = czas * 360
    else if rodzaj == "h" then
        rodzaj = "godzin"
        czas1 = czas * 60 * 60
    end
    end
    end
    end
    end
 -- outputChatBox ( "Czas: "..czas.." "..rodzaj.."", root )
    banPlayer ( player, true, true, true, plr, tresc, czas1 )
end)



client

addEvent("info",true)
addEventHandler("info",resourceRoot,function(plr,cel,nick,co,tresc)
    if wyswietlainfo == true then return end
    function info()
        dxDrawRectangle(screenW * 0.3675, screenH * 0.0000, screenW * 0.2650, screenH * 0.0956, tocolor(0, 0, 0, 83), false)
        dxDrawText( cel.." "..co.." "..nick..". \nPow?d: "..tresc, screenW * 0.3675, screenH * 0.0000, screenW * 0.6325, screenH * 0.0956, tocolor(255, 0, 0, 255), 1.00, "default", "center", "center", false, true, false, false, false)
    end
    wyswietlainfo = true
    addEventHandler("onClientRender",root,info)
    setTimer(function()
        removeEventHandler("onClientRender",root,info)
        wyswietlainfo = false
    end,5000,1)
end)

addEvent("infoczas",true)
addEventHandler("infoczas",resourceRoot,function(plr,cel,nick,co,tresc,czas)
    if wyswietla == true then return end
    if czas == "na zawsze" then
        czas = "zawsze"
        czasname = ""
    else
        czas = tonumber(czas)
        if czas < 60 then
            czasname = " sekund"
        elseif czas >= 60 and czas <= 3599 then
            czas = math.round(czas/60)
            czasname = " minut"
        elseif czas >= 3600 and czas <= 86399 then
            czas = math.round(czas/3600)
            czasname = " godzin"
        elseif czas >= 86400 then
            czas = math.round(czas/86400)
            czasname = " dni"
        end
    end
    function info()
        dxDrawRectangle(screenW * 0.3675, screenH * 0.0000, screenW * 0.2650, screenH * 0.0956, tocolor(0, 0, 0, 83), false)
        dxDrawText(cel.." "..co.." "..nick.." na "..czas..""..czasname..". \nPow?d: "..tresc, screenW * 0.3675, screenH * 0.0000, screenW * 0.6325, screenH * 0.0956, tocolor(255, 0, 0, 255), 1.00, "default", "center", "center", false, true, false, false, false)
    end
    wyswietlainfo = true
    addEventHandler("onClientRender",root,info)
    setTimer(function()
        removeEventHandler("onClientRender",root,info)
        wyswietlainfo = false
    end,5000,1)
end)


prosz? o pomoc :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-19, 16:02


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

polaczkos, else if ? daj elseif a nie else if po stronie serwera, nie dziwi? si? ?e nie dzia?a. Powiniene? mie? errory w debugu /debugscript 3 ale jak podmienisz, to powinno dzia?a?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-19, 16:26


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

dzia? lecz wyskakuje puste okienko a powino sie pokazduwa? komu od kogo i za co i na ile

serwer

addCommandHandler ( "zbanuj", function ( plr, cmd, gracz, czas, rodzaj, cel, ... )
     local login = getAccountName ( getPlayerAccount ( plr ) )
    if sprawdzRoota(login) or sprawdzAdmina(login) or sprawdzModeratora(login) then
    if cel then
    player = getPlayerFromName(gracz)
    if not player then return end
    tresc = table.concat ( {...}, " " )
                    local nick = getPlayerName(plr)
                    local cel = getPlayerName(gracz)
                    local co = " zosta? zbanowany/a "
                    triggerClientEvent("info",resourceRoot,root,nickcel,nick,co,tresc)
    if rodzaj == "m" then
        rodzaj = "minut"
        czas1 = czas * 60
    elseif rodzaj == "d" then
        rodzaj = "dni"
        czas1 = czas * 360
    elseif rodzaj == "h" then
        rodzaj = "godzin"
        czas1 = czas * 60 * 60
    end
    end
    end
 -- outputChatBox ( "Czas: "..czas.." "..rodzaj.."", root )
    banPlayer ( player, true, true, true, plr, tresc, czas1 )
end)


client

addEvent("info",true)
addEventHandler("info",resourceRoot,function(plr,cel,nick,co,tresc)
    if wyswietlainfo == true then return end
    function info()
        dxDrawRectangle(screenW * 0.3675, screenH * 0.0000, screenW * 0.2650, screenH * 0.0956, tocolor(0, 0, 0, 83), false)
        dxDrawText( cel.." "..co.." "..nick..". \nPow?d: "..tresc, screenW * 0.3675, screenH * 0.0000, screenW * 0.6325, screenH * 0.0956, tocolor(255, 0, 0, 255), 1.00, "default", "center", "center", false, true, false, false, false)
    end
    wyswietlainfo = true
    addEventHandler("onClientRender",root,info)
    setTimer(function()
        removeEventHandler("onClientRender",root,info)
        wyswietlainfo = false
    end,5000,1)
end)

addEvent("infoczas",true)
addEventHandler("infoczas",resourceRoot,function(plr,cel,nick,co,tresc,czas)
    if wyswietla == true then return end
    if czas == "na zawsze" then
        czas = "zawsze"
        czasname = ""
    else
        czas = tonumber(czas)
        if czas < 60 then
            czasname = " sekund"
        elseif czas >= 60 and czas <= 3599 then
            czas = math.round(czas/60)
            czasname = " minut"
        elseif czas >= 3600 and czas <= 86399 then
            czas = math.round(czas/3600)
            czasname = " godzin"
        elseif czas >= 86400 then
            czas = math.round(czas/86400)
            czasname = " dni"
        end
    end
    function info()
        dxDrawRectangle(screenW * 0.3675, screenH * 0.0000, screenW * 0.2650, screenH * 0.0956, tocolor(0, 0, 0, 83), false)
        dxDrawText(cel.." "..co.." "..nick.." na "..czas..""..czasname..". \nPow?d: "..tresc, screenW * 0.3675, screenH * 0.0000, screenW * 0.6325, screenH * 0.0956, tocolor(255, 0, 0, 255), 1.00, "default", "center", "center", false, true, false, false, false)
    end
    wyswietlainfo = true
    addEventHandler("onClientRender",root,info)
    setTimer(function()
        removeEventHandler("onClientRender",root,info)
        wyswietlainfo = false
    end,5000,1)
end


debugscript 3



Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-19, 17:54


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

polaczkos, w serwerze masz local cel = getPlayerName(gracz) daj local cel = getPlayerName(player)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-20, 16:21


polaczkos







Wiek: 26
Na forum: 4226 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

ju? banuje ale dalej nie dzia?a wy?wietlanie

Postaw piwo autorowi tego posta
 

 
Tagi: bany
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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