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

Wysłany: 2015-09-21, 21:45


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Witam, chcia?bym si? spyta? jak doda?, aby chat by? tylko dla kogo? kto jest w ACL
"Premium" ? Chodzi mi o globala..
Skrypt By DaxRel69

Kod:



function RGBToHex(redgreenbluealpha)
    if((red or red 255 or green or green 255 or blue or blue 255) or (alpha and (alpha or alpha 255))) then
        return nil
    end
    if(alphathen
        return string.format("#%.2X%.2X%.2X%.2X"red,green,blue,alpha)
    else
        return string.format("#%.2X%.2X%.2X"red,green,blue)
    end
end



function onChat(message,messagetype)
    
     if isGuestAccount(getPlayerAccount(source)) then
        outputChatBox("Najpierw wejd? do gry."source255000000)
        return end
    
    if messagetype == 0 then
        cancelEvent()
        local xygetElementPosition(source)
        local chatCol createColSphere(x,y,z,20)
        local chatRadius getElementsWithinColShape(chatCol)
        local rggetPlayerNametagColor(source)
        for keyvalue in ipairs(chatRadius) do 
        outputChatBox(getPlayerName(source).."#FFFFFF: "..message,value,r,g,b,true)
       end
       outputServerLog("LOCAL "..getPlayerName(source)..": "..message)
       -- if not isPedInVehicle(sourcethen
        --local talktime string.len(message)*200
            
          --  setPedAnimation(source,"ped","IDLE_chat",0,true,false,true,true)
            --setTimer(function () setPedAnimation(source,nilnilnil)end,talktime,1)
        --end
    


    
        elseif messagetype == 1 then
        cancelEvent()
        local xygetElementPosition(source)
        local chatCol createColSphere(x,y,z,30)
        local chatRadius getElementsWithinColShape(chatCol)
        for keyvalue in ipairs(chatRadius) do 
        outputChatBox("#FF5555*"..getPlayerName(source).." "..message,value,0,0,0,true)
        outputServerLog("ME *"..getPlayerName(source).." "..message)
    end
end
end



addEventHandler("onPlayerChat",getRootElement(),onChat)

function global(psource,command,...)
    if isGuestAccount(getPlayerAccount(psource)) then
        outputChatBox("Najpierw wejd? do gry."psource255000000)
        return end
    
local tekst table.concat({...}," ")
r,g,getPlayerNametagColor(psource)
outputChatBox("#FF0000[Global] "..RGBToHex(r,g,b)..getPlayerName(psource).."#FFFFFF: "..tekst,getRootElement(),r,g,b,true)
outputServerLog("GLOBAL "..getPlayerName(psource)..": "..tekst)
end

addCommandHandler("global",global)


addEventHandler("onPlayerLogin",getRootElement(),function ()
bindKey(source,"u","down","chatbox","global")
end)


addEventHandler("onResourceStart"root,
function (  )
for k,v in ipairs(getElementsByType("player"root)) do
unbindKey(v"u""down""chatbox""global")
bindKey(v"u","down","chatbox","global")
end
end)


Chcia?bym doda?, aby mogl na globalu pisa? tylko Admin ,Moderator i Premium
ACL:
Admin : Admin
Moderator : Moderator
Premium : Premium

Wiem, ze jest to bardzo proste, ale nie mog? ogarn?? gdzie i w kt?rym miejscu to wstawia? ;v
Za pomoc oczywi?cie piwko.. i reputacja!
Pozdrawiam,
mlodasny. :DDD

[/b]

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-21, 21:48


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%

Więcej informacji znajdziesz w Wikipedii MTA:

isObjectInACLGroup
- posiadasz tam przyk?ad u?ycia i potrzebne do tej funkcji parametry.

Tworzysz tak? instrukcj? warunkow?, je?eli jest w tej grupie wykonujesz reszt? kodu, je?eli nie, zostawiasz pustke.

W jakim miejscu ? - Sugeruj? pod warunkiem na bycie zalogowanym, przynajmniej 1 problem odpadnie xD.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-22, 15:40


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Emm, ok?

Czy teraz dobrze doda?em i czy dobrze zrobi?em aby mogl jeszcze RCON?
Fragment Kodu...


function global(psource,command,...)
    if isGuestAccount(getPlayerAccount(psource)) then
    accountname getAccountName (getPlayerAccount(v))
      ifObjectInACLGroup "user." .. accountnameaclGetGroup "Admin" ) ) then or ifObjectInACLGroup "user." .. accountnameaclGetGroup "RCON" ) ) then
    end
        outputChatBox("Najpierw wejd? do gry."psource255000000)
        return end
    
local tekst table.concat({...}," ")
r,g,getPlayerNametagColor(psource)
outputChatBox("#FF0000[Global] "..RGBToHex(r,g,b)..getPlayerName(psource).."#FFFFFF: "..tekst,getRootElement(),r,g,b,true)
outputServerLog("GLOBAL "..getPlayerName(psource)..": "..tekst)
end


addCommandHandler("global",global)


Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-22, 15:44


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
bardziej co? takiego



function global(psource,command,...)
    if isGuestAccount(getPlayerAccount(psource)) then
    outputChatBox("Najpierw wejd? do gry."psource255000000)
    return end
    
    accountname getAccountName(getPlayerAccount(psorce))
    if isObjectInACLGroup"user." .. accountnameaclGetGroup "Admin" ) ) or isObjectInACLGroup"user." .. accountnameaclGetGroup("RCON")) then
    
        local tekst table.concat({...}," ")
        r,g,getPlayerNametagColor(psource)
        outputChatBox("#FF0000[Global] "..RGBToHex(r,g,b)..getPlayerName(psource).."#FFFFFF: "..tekst,getRootElement(),r,g,b,true)
        outputServerLog("GLOBAL "..getPlayerName(psource)..": "..tekst)
    else
        outputChatBox("Brak dost?pu do chatu"psource25500)
    end
    
end

addCommandHandler("global",global)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-22, 20:09


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Stoj? na takim czym?...

function RGBToHex(redgreenbluealpha)
    if((red or red 255 or green or green 255 or blue or blue 255) or (alpha and (alpha or alpha 255))) then
        return nil
    end
    if(alphathen
        return string.format("#%.2X%.2X%.2X%.2X"red,green,blue,alpha)
    else
        return string.format("#%.2X%.2X%.2X"red,green,blue)
    end
end




addEventHandler("onPlayerChat",getRootElement(),onChat)

function global(psource,command,...)
    if isGuestAccount(getPlayerAccount(psource)) then
    outputChatBox("Najpierw wejd? do gry."psource255000000)
    return end
    
    accountname getAccountName(getPlayerAccount(psorce))
    if isObjectInACLGroup"user." .. accountnameaclGetGroup "Admin" ) ) or isObjectInACLGroup"user." .. accountnameaclGetGroup ("RCON") ) or isObjectInACLGroup"user." .. accountnameaclGetGroup ("Moderator") ) or isObjectInACLGroup"user." .. accountnameaclGetGroup ("Console") ) or isObjectInACLGroup"user." .. accountnameaclGetGroup ("SuperModerator") ) or isObjectInACLGroup"user." .. accountnameaclGetGroup ("Premium") ) then
    
        local tekst table.concat({...}," ")
        r,g,getPlayerNametagColor(psource)
        outputChatBox("#FF00cc[Global] #ffffff"..RGBToHex(r,g,b)..getPlayerName(psource).."#FFFFFF: "..tekst,getRootElement(),r,g,b,true)
        outputServerLog("GLOBAL "..getPlayerName(psource)..": "..tekst)
    else
        outputChatBox("Brak dost?pu do chatu"psource25500)
    end
    
end

addCommandHandler("global",global)


addEventHandler("onPlayerLogin",getRootElement(),function ()
bindKey(source,"u","down","chatbox","global")
end)


addEventHandler("onResourceStart"root,
function (  )
for k,v in ipairs(getElementsByType("player"root)) do
unbindKey(v"u""down""chatbox""global")
bindKey(v"u","down","chatbox","global")
end
end)


Ale gdy pisze na u pojawia si? te "Global:" Ale jak napisze np. "Global: TEST" To nie wy?wietla si? .
Usun??em locala, narazie nie potrzebny.

Pozdrawiam,
mlodasny

[ Dodano: 2015-09-23, 19:32 ]
No i jak? Bo co nie pyka..

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-02, 16:31


Fanciak

BOT






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

Piwa: 1572

Respekt: 500
Respekt: 500

function RGBToHex(redgreenbluealpha)
    if((red or red 255 or green or green 255 or blue or blue 255) or (alpha and (alpha or alpha 255))) then
        return nil
    end
    if(alphathen
        return string.format("#%.2X%.2X%.2X%.2X"red,green,blue,alpha)
    else
        return string.format("#%.2X%.2X%.2X"red,green,blue)
    end
end





function global ( thePlayer_, ... )
    local message table.concat ( { ... }, " " )
       if isGuestAccount(getPlayerAccount(psource)) then
    outputChatBox("Najpierw wejd? do gry."psource255000000)
    return end
    if ( isPlayerOnGroup thePlayer ) ) then
        for _player in ipairs getElementsByType "player" ) ) do
            if ( isPlayerOnGroup player ) ) then
                r,g,getPlayerNametagColor(thePlayer)
                outputChatBox "#FF00cc[Global] #ffffff"..RGBToHex(r,g,b)..getPlayerName(thePlayer).."#FFFFFF: ".. messageplayerrgbtrue )
                outputServerLog("GLOBAL "..getPlayerName(thePlayer)..": "..message)
            end
        end
    else
        outputChatBox "#ff0012Nie masz uprawnie? do tej komendy."thePlayerrgbtrue )
    end
end
addCommandHandler "global", global )
 
function isPlayerOnGroup thePlayer )
    local account getPlayerAccount thePlayer )
    local inGroup false
    for _group in ipairs ( { "RCON""Admin""SuperModerator""Moderator""Console""Premium" } ) do  
        if isObjectInACLGroup "user.".. getAccountName account ), aclGetGroup group ) )   then
            inGroup true
            break
        end
    end
 
    return inGroup
end




addEventHandler("onPlayerLogin",getRootElement(),function ()
bindKey(source,"u","down","chatbox","global")
end)


addEventHandler("onResourceStart"root,
function (  )
for k,v in ipairs(getElementsByType("player"root)) do
unbindKey(v"u""down""chatbox""global")
bindKey(v"u","down","chatbox","global")
end



Powinno byc git

Postaw piwo autorowi tego posta
 

 
Tagi: dodanie :: chatu :: tylko :: dla :: acl!!!
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