Shako 97 Report post Posted August 12, 2016 I know it's possible, but I can't recall how to do it. When in a maze, instead of saying "There are currently X players in MAP", it says "There are currently X Players in a MAP: Name1, Name2, Name3, Name4" etc. Does anyone know? Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Billy 164 Report post Posted August 12, 2016 If you look in CA ctrl.lua at the function that is called when map is closing, there is a function DealAllActiveInMap(map,func). Make you can add something like this before announcing players: function GetPlayerNames (role) table. insert(PlayersInMap,GetChaDefaultName(role)) end -- PlayersInMap = {} DealAllActiveInMap (map,'GetPlayerNames') local ListPlayers = '' for i,v in pairs(PlayersInMap) do ListPlayers = string.format('%s [%s],',ListPlayers,v) end local msg = string.format('MAPNAME has [%s] players remaining: %s' , GetMapActivePlayer(map) , ListPlayers) Notice(msg) -- Quote Share this post Link to post Share on other sites
Emiliano 1 Report post Posted August 13, 2016 hmm every those in ctrl??? Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted August 13, 2016 Hello @Shako You can use GetMapCopyNextPlayerCha(map_copy) function for example function GetPlayerList(map) local players = {} local ply_num = GetMapCopyPlayerNum(map) BeginGetMapCopyPlayerCha(map) for i = 0, ply_num - 1, 1 do local player = GetMapCopyNextPlayerCha(map) if (ValidCha(player) == 1) then players[i] = player end end return players end 1 Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Shako 97 Report post Posted August 13, 2016 (edited) On 8/12/2016 at 11:03 PM, 7n6 said: If you look in CA ctrl.lua at the function that is called when map is closing, there is a function DealAllActiveInMap(map,func). Make you can add something like this before announcing players: function GetPlayerNames (role) table. insert(PlayersInMap,GetChaDefaultName(role)) end -- PlayersInMap = {} DealAllActiveInMap (map,'GetPlayerNames') local ListPlayers = '' for i,v in pairs(PlayersInMap) do ListPlayers = string.format('%s [%s],',ListPlayers,v) end local msg = string.format('MAPNAME has [%s] players remaining: %s' , GetMapActivePlayer(map) , ListPlayers) Notice(msg) -- Nice script! Thank you! I was able to combine this script with another function on my other thread in order to create something that calls the remaining players and names every 5 seconds in the map. Your script had some wrong function names in them so I fixed them for you. This is my script that I made for Chaos Argent: Chaos_Argent_Tick = 0 function GetPlayerNames (role) table.insert ( PlayersInMap , GetChaDefaultName ( role ) ) end function map_copy_run_garner2 ( map_copy ) local Map_Description = "Chaos Argent" Chaos_Argent_Tick = Chaos_Argent_Tick + 1 PlayersInMap = {} DealAllActivePlayerInMap ( map_copy , 'GetPlayerNames' ) local ListPlayers = '' for i,v in pairs ( PlayersInMap ) do ListPlayers = string.format( '%s [%s],' , ListPlayers , v ) end if math.mod ( Chaos_Argent_Tick, 5 ) == 0 then local msg = string.format( "["..Map_Description.."] has [%s] players remaining:%s" , GetMapActivePlayer ( map_copy ) , ListPlayers ) Notice ( msg ) end end Works Perfectly! Credits of help to: @V3ct0r & @7n6 Edited August 13, 2016 by Shako Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Shako 97 Report post Posted August 13, 2016 @7n6 on the end of the announcement though, it will have a comma "," that doesn't belong is there way to remove it? Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Shako 97 Report post Posted August 13, 2016 4 hours ago, V3ct0r said: Hello @Shako You can use GetMapCopyNextPlayerCha(map_copy) function for example function GetPlayerList(map) local players = {} local ply_num = GetMapCopyPlayerNum(map) BeginGetMapCopyPlayerCha(map) for i = 0, ply_num - 1, 1 do local player = GetMapCopyNextPlayerCha(map) if (ValidCha(player) == 1) then players[i] = player end end return players end I don't quite know how to put this into use @V3ct0r! Could you help out? When returned "players", how do I announce them? THX! Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted August 13, 2016 @Shako try put ListPlayers = string.sub(ListPlayers, 1, string.len(ListPlayers) - 1) after for in pairs loop. It should delete last comma from string. Also you can use my method function map_copy_run_garner2 ( map_copy ) Chaos_Argent_Tick = Chaos_Argent_Tick + 1 if (math.mod(Chaos_Argent_Tick, 5) == 0) then local players = '' local ply_num = GetMapCopyPlayerNum(map_copy) BeginGetMapCopyPlayerCha(map_copy) for i = 0, ply_num - 1, 1 do local player = GetMapCopyNextPlayerCha(map_copy) if (ValidCha(player) == 1 and Hp(player) > 0) then players = string.format('%s [%s]', players, GetChaDefaultName(player)) if (i < ply_num - 2) then players = string.format('%s, ', players) end end end local msg = string.format( "[Chaos Argent] has [%s] players remaining: %s" , GetMapActivePlayer(map_copy), players) Notice(msg) end end but I didn't test it Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Shako 97 Report post Posted August 13, 2016 @V3ct0r I don't have time to test it right now, but looking at the script it should do the same exact thing! thanks both of you for helping with the script. Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites