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

Wysłany: 2015-05-20, 12:20


Tomakan

Człowiek






Wiek: 26
Na forum: 4061 dni
Posty: 94
Nick w MP: Tomakan

Piwa: 5

Respekt: 50

Chcia?em si? spyta?, i? jeszcze si? do tego nie zabieram a mo?e ?le my?l?.
Mog? zrobi? czat frakcyjny za pomoc? tej funkcji?
getTeamFromName

U?y? jej podobnie jak tu, tyle ?e z outputChatBox() ?
createTeam("Red"25500)
 
function joinRedTeam (source)
    local redteam getTeamFromName("Red")
    if (redteamthen -- If the team was successfully created
        -- Sets the player's team by getting the partial name of the red team.
        setPlayerTeam(client, readteam)
        outputChatBox("You are now in the 'Red' team", source)
    else
        outputChatBox("Sorry, we can't set your teamAn error occurred!", source)
    end
end
 
--Add console command to join the team when 'joinTeam' is typed.
addCommandHandler("jointeam", joinRedTeam)

Wiem, ?e jest czat pod y jednak posiadam w?asny system frakcji i potrzeba mi oto takiego czatu, na komend?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-20, 13:44


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Przyk?ad mojego chatu :


addEventHandler("onPlayerLogin",root,function()
        bindKey(source,"n","down","chatbox","Frakcja")
end)


addCommandHandler("Frakcja",function(plr,cmd,...)
        if ... then
            local frakcja=getElementData(plr,"player:fraction")
            if frakcja then
                for _,v in ipairs (getElementsByType("player")) do
                    if getElementData(v,"player:fraction"then
                        if getElementData(v,"player:fraction")==frakcja then
                            local msg=table.concat({...}," ")
                            outputChatBox("#ff0000"..frakcja.." >#ffffff "..getPlayerName(plr).." : "..msg,v,255,255,255,true)
                        end
                    end
                end
            end
        end
end)


Podpis

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

 
Wysłany: 2015-05-20, 14:50


Tomakan

Człowiek






Wiek: 26
Na forum: 4061 dni
Posty: 94
Nick w MP: Tomakan

Piwa: 5

Respekt: 50

Mog?oby to wygl?da? tak?
addCommandHandler("Frakcja",function(plr,cmd,...)

    if ... then
        local frakcja getPlayerTeam(plr)
        if frakcja then
            for _,v in ipairs (getElementsByType("player")) do
                if getElementData(v,"player:fraction"then
                    if getElementData(v,"player:fraction")==frakcja then
                        local msg=table.concat({...}," ")
                        outputChatBox("#ff0000"..frakcja.." >#ffffff "..getPlayerName(plr).." : "..msg,v,255,255,255,true)
                    end
                end
            end
        end
    end
    
end)

Tylko, ?e nie wiem co wsadzi? w tym miejscu, w sumie wiem co zrobi?, przynajmniej my?l?, ?e pobra? graczy z teamu;
                if getElementData(v,"player:fraction"then
                    if getElementData(v,"player:fraction")==frakcja then
                        local msg=table.concat({...}," ")
                        outputChatBox("#ff0000"..frakcja.." >#ffffff "..getPlayerName(plr).." : "..msg,v,255,255,255,true)
                    end
                end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-20, 17:52


Tomakan

Człowiek






Wiek: 26
Na forum: 4061 dni
Posty: 94
Nick w MP: Tomakan

Piwa: 5

Respekt: 50

Zrobi?em w inny spos?b, do?? prosty, tutaj dla ciekawskich.

local playerTeam getPlayerTeam(source)
            local pobierz getPlayersInTeamplayerTeam )
            
            for indexgoscie in ipairspobierz ) do
                
                outputChatBox(""goscie255255255true)
                
            end


Postaw piwo autorowi tego posta
 

 
Tagi: czat :: frakcyjny
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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