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

Wysłany: 2015-01-17, 14:11


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Cze??.

Pr?bowa?em doda? tutaj opcj? banowania na czas, ale nie posz?o co?. Pomo?ecie mi zrobi? tak, ?e wpisze np. /ban Fanciak 1 h test to po up?ywie tego 1h mnie odbanowywa?o?

function banPlayerCommand theClientcommandNameplayerbannedNamereasoncelczasjednostka, ... )
local accName getAccountName getPlayerAccount plr ) ) 
     if isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then
    
    local reason table.concatarg" " )
    if (not cel or not czas or not jednostkathen
outputChatBox("Uzyj: /aban <nick> <czas> <jednostka:m/h/d> <powod>"plr)
return
end
    jednostka=string.lower(jednostka)
if (jednostka=="m"then
jednostka="MINUTE"
elseif (jednostka=="h" or jednostka=="g"then
jednostka="HOUR"
elseif (jednostka=="d"then
jednostka="DAY"
else
outputChatBox("Jednostki: m - minuta, h - godzina, d - dzien"plr)
return
end
czas=tonumber(czas)
if (not czas or czas<1then
outputChatBox("Nieprawidlowy okres czasu.",plr)
return
end
    if ( hasObjectPermissionTo theClient"function.banPlayer" ) ) then
        local bannedPlayer getPlayerFromName bannedName )
 
        banPlayer bannedPlayertheClientreason )
        outputChatBox "Gracz " .. bannedName .. " zosta?/a zbanowany/a."theClient )
 
    else
        outputChatBox "Brak praw"theClient )
    end
 
end
end
addCommandHandler "aban"banPlayerCommand )
 
function banCheater(theCheater)
    banPlayer(theCheatergetRootElement(), "Zosta?e?/a? zbanowany/a na tym serwerze.")
end

Firewall = 
{
    [ 'AccountName' ] = 'SerialPlayer',
    [ '3ash8' ] = '9C9F3B55D9D7BB7135FF274D3BF444E4',
    [ 'test5' ] = '1D6F76CF8D7193792D13789849498452',
}
 
addEventHandler 'onPlayerLogin'getRootElement ( ),
    function ( _theCurrentAccount )
    local Serial Firewall[getAccountName(theCurrentAccount)]
        if ( Serial then
            if Serial ~= getPlayerSerial source then
                banPlayer sourcefalsefalsetruegetRootElement ( ), 'reason ban' )
            end
        end
    end
)


W kodzie pomog?o mi wiki.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 14:23


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Przer?b tylko pod Sw?j serwer i b?dzie dzia?a?.


addCommandHandler "gracz.ban", function ( plrcmdgraczczasrodzaj, ... )
    if not isObjectInACLGroup "user."..getPlayerName plr ), aclGetGroup "Admin" ) ) then return end
    if not gracz and not rodzaj and not czas and not ... or not gracz == nil or rodzaj == nil or czas == nil then
        return outputChatBox "[U?ycie] /gracz.ban <gracz> <czas> <rodzaj : m,s,h> <pow?d>"plr end
    player exports["GTAO_Gamemode"]:partNick plrgracz )
    if not player then return end
    txt table.concat ( {...}, " " )
    outputChatBox "Zarz?dca "..getPlayerName(plr).." ( ID "..getElementData plr"playerid" ).." ) zbanowa? gracza "..getPlayerName(player).." ( "..getElementData player"playerid" ).." )"root )
    outputChatBox "Pow?d : "..txtroot )
    if rodzaj == "m" then
        rodzaj "minut"
        czas1 czas 60
    elseif rodzaj == "s" then
        rodzaj "sekund"
        czas1 czas
    elseif rodzaj == "h" then
        rodzaj "godzin"
        czas1 czas 60 60
    end
    outputChatBox "Czas : "..czas.." "..rodzaj..""root )
    banPlayer playertruetruetrueplrtxtczas1 )
end)


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 14:38


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Przerobi?em to tak:


addCommandHandler "aban", function ( plrcmdgraczczasrodzaj, ... )
    if not isObjectInACLGroup "user."..getPlayerName plr ), aclGetGroup "Admin" ) ) then return end
    if not gracz and not rodzaj and not czas and not ... or not gracz == nil or rodzaj == nil or czas == nil then
        return outputChatBox "U?yj: /aban <gracz> <czas> <rodzaj : m,s,h> <pow?d>"plr end
    outputChatBox "Gracz "..getPlayerName(player).." zosta?/a zbanowany/a przez "..getPlayerName(plr)..""root )
    outputChatBox "Pow?d : "..txtroot )
    if rodzaj == "m" then
        rodzaj "minut"
        czas1 czas 60
    elseif rodzaj == "s" then
        rodzaj "sekund"
        czas1 czas
    elseif rodzaj == "h" then
        rodzaj "godzin"
        czas1 czas 60 60
    end
    outputChatBox "Czas: "..czas.." "..rodzaj..""root )
    banPlayer playertruetruetrueplrtxtczas1 )
end)


DB3:

5 linijka attempt to concatenate a boolean value


Usun??em t? linijke z GTAO_Gamemode

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 14:57


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

ta linijka pobiera?a gracza po cz?sci nicku..

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 15:06


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

To zauwa?y?em, ale nie zale?y mi na tym. Nicki mog? wpisywa? ca?e, wi?c dlaczego nie daje bana?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 15:13


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Bo usun??e? pobieranie gracza

Dodaj nad info o zbanowaniu


player gracz


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 15:27


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Obecny kod:

addCommandHandler "aban", function ( plrcmdgraczczasrodzaj, ... )
    if not isObjectInACLGroup "user."..getPlayerName plr ), aclGetGroup "Admin" ) ) then return end
    if not gracz and not rodzaj and not czas and not ... or not gracz == nil or rodzaj == nil or czas == nil then
        return outputChatBox "U?yj: /aban <gracz> <czas> <rodzaj : m,s,h> <pow?d>"plr end
    player gracz
    if not player then return end
    txt table.concat ( {...}, " " )
    outputChatBox "Gracz "..getPlayerName(player).." zosta?/a zbanowany/a przez "..getPlayerName(plr)..""root )
    outputChatBox "Pow?d : "..txtroot )
    if rodzaj == "m" then
        rodzaj "minut"
        czas1 czas 60
    elseif rodzaj == "s" then
        rodzaj "sekund"
        czas1 czas
    elseif rodzaj == "h" then
        rodzaj "godzin"
        czas1 czas 60 60
    end
    outputChatBox "Czas: "..czas.." "..rodzaj..""root )
    banPlayer playertruetruetrueplrtxtczas1 )
end)


DB3 wywala taki b??d:

8 linijka WARNIG Bad argument 'getPlayerName' [Expected element at argument 1got string 'Fanta']
ERROR attempt to concatenate a boolean value


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 15:43


Gerano

Mleko,Kakao,LUA






Wiek: 38
Na forum: 4266 dni
Posty: 187
Nick w MP: Gerano

Piwa: 1460

Respekt: 146,3
Respekt: 146,3

Ostrzeżeń: 100%
wed?ug mnie masz tu wszystko dobrze sprawdza?em to no i jest dobrze

Podpis
BUDOWA SERWERA: XXX

Prace: XXX%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 15:47


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Gerano, dzia?a Ci skrypt bez b??d?w?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 15:48


Gerano

Mleko,Kakao,LUA






Wiek: 38
Na forum: 4266 dni
Posty: 187
Nick w MP: Gerano

Piwa: 1460

Respekt: 146,3
Respekt: 146,3

Ostrzeżeń: 100%
czeka zaraz ci powiem

[ Dodano: 2015-01-17, 15:50 ]
daj mete

Podpis
BUDOWA SERWERA: XXX

Prace: XXX%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 16:00


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

T? linijke co Ci poda?em wy?ej zamie? na :

player getPlayerFromName gracz )


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 16:02


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Nie testowane ale powinno dzia?a?.

addCommandHandler "aban", function ( plrcmdgraczczasrodzaj, ... )
    if not isObjectInACLGroup "user."..getPlayerName plr ), aclGetGroup "Admin" ) ) then return end
    if not gracz and not rodzaj and not czas and not ... or not gracz == nil or rodzaj == nil or czas == nil then
        return outputChatBox "U?yj: /aban <gracz> <czas> <rodzaj : m,s,h> <pow?d>"plr end
    player getPlayerFromName(gracz)
    if not player then return end
    txt table.concat ( {...}, " " )
    outputChatBox "Gracz "..getPlayerName(player).." zosta?/a zbanowany/a przez "..getPlayerName(plr)..""root )
    outputChatBox "Pow?d : "..txtroot )
    if rodzaj == "m" then
        rodzaj "minut"
        czas1 czas 60
    elseif rodzaj == "s" then
        rodzaj "sekund"
        czas1 czas
    elseif rodzaj == "h" then
        rodzaj "godzin"
        czas1 czas 60 60
    end
    outputChatBox "Czas: "..czas.." "..rodzaj..""root )
    banPlayer playertruetruetrueplrtxtczas1 )
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 16:24


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

TheTroll, dzia?a, ale nie banuje gdy? w DB3 jest jeden b??d - Access denied @ 'banPlayer', a w ACL mam Admin.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 16:35


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Musisz doda? ten skrypt do Admina.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-17, 17:40


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Dzia?a, dzi?ki.

?eby nie tworzy? nowego tematu wstawie nast?pny problem - nie pokazuje wiadomo?ci na chacie.

function kickPlayerHandler sourcePlayercommandnamekickednameplrreason )
    local kicked getPlayerFromName kickedname )
    if ( hasObjectPermissionTo sourcePlayer"function.kickPlayer" ) ) then
        kickPlayer kickedsourcePlayerreason )
        outputChatBox("Gracz " .. getPlayerName(kicked) .. " zosta? wyrzucony/a. Pow?d: " .. reason .. ""source25500)
    end
end
addCommandHandler "akick"kickPlayerHandler )
Oraz jak doda? tu nick osoby, kt?ra kickuje gracza?

Postaw piwo autorowi tego posta
 

 
Tagi: ban :: czas
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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