Подскажите пожалуйста, уже неделю ломаем голову почему из list вытягивается в строку только первую запись NickName=9813281328787132213,
Остальные записи игнорируются., а должно быть NickName=9813281328787132213,NickName2=199124912441923121,NickName3=14421412412412412
using System.Collections.Generic;
using System.Linq;
namespace Oxide.Plugins
{
[Info("GameSib", "Drop Dead", "1.0.0")]
public class GameSib : RustPlugin
{
public Dictionary<ulong, string> playerlist = new Dictionary<ulong, string>();
const int secondstoupdate = 120;
const string serverid = "169";
const string api = "https://site.ru/playerinfo.php";
const string args = "?idserver={ID}&update_time={secondstoupdate}&ip={IP}&port={PORT}&qport={QPORT}&online={ONLINE}&slots={SLOTS}&players_list={NICNAME_SteamID}";
void OnServerInitialized()
{
InvokeHandler.Instance.InvokeRepeating(SendAPI, 20f, secondstoupdate);
foreach (var player in BasePlayer.activePlayerList)
OnPlayerConnected(player);
}
void Unload()
{
InvokeHandler.Instance.CancelInvoke(SendAPI);
}
void OnPlayerConnected(BasePlayer player)
{
if (player.IsReceivingSnapshot)
{
NextTick(() => OnPlayerConnected(player));
return;
}
if (!playerlist.ContainsKey(player.userID))
playerlist.Add(player.userID, player.displayName);
}
void OnPlayerDisconnected(BasePlayer player)
{
if (playerlist.ContainsKey(player.userID))
playerlist.Remove(player.userID);
}
void SendAPI()
{
var playerlists = DictToString(playerlist);
string link = api + args.Replace("{ID}", serverid).Replace("{secondstoupdate}", secondstoupdate.ToString()).Replace("{IP}", ConVar.Server.ip).Replace("{PORT}", ConVar.Server.port.ToString()).Replace("{QPORT}", ConVar.Server.queryport.ToString())
.Replace("{ONLINE}", BasePlayer.activePlayerList.Count.ToString()).Replace("{SLOTS}", ConVar.Server.maxplayers.ToString()).Replace("{NICNAME_SteamID}", playerlists);
Puts(link);
webrequest.Enqueue(link, null, (code, response) =>
{
}, this, Core.Libraries.RequestMethod.POST);
}
public static string DictToString(Dictionary<ulong, string> dictionary)
{
if (dictionary == null)
return "null";
if (dictionary.Count < 1) return "null";
var items = from kvp in dictionary
select kvp.Key + "=" + kvp.Value;
return "{" + string.Join(",", items) + "}";
}
}
}