• Üyelik paylaşımı yasaktır! Hesabınızı başkalarına vermeyin! Hesap paylaşımları yasaklama ile sonuçlanacaktır.

swf flash c# örnek Main

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

dede454531

ReportSpammer
Banlı Üye
Katılım
15 Ara 2017
Mesajlar
299
Beğeni Puanı
23
C#:
using PlayerIO.GameLibrary;
using System;
using System.Collections.Generic;
using System.Net;

namespace Main
{
    public class Player : BasePlayer
    {

    }

    [RoomType("NinjaGoRun")]
    public class Rareslot : Game<Player>
    {
        string[] ultra = { "mobashoes", "lavasword", "lambosword", "whitewizardhat", "whitewizardshoes", "whitewizardcepter", "freezesword", "legitsword", "whitewizardeyes", "legithat", "scbow", "nvhat", "nvshoes", "metalsword", "crystalsword", "minigun", "diamondgloves", "nvaxe", "dragonclaw", "novahair", "novaeyes", "novabandana", "novasword", "novashoes", "crystalhair", "crystalglasses", "crystalshoes", "atlantshand", "bluesharkaxe", "ultrahead", "ultramouth", "ultrabow", "ultrashoes", "yntiquehat", "yntiqueclaw", "yntiqueshoes", "sunrisehat", "sunrisesword", "sunriseshoes", "choaticwizardhat", "choaticwizardeyes", "choaticwizardbeard", "choaticwizardclaw", "choaticwizardshoes", "firehair", "pinkkatana", "halloweenbow", "chillinghat", "supersaiyanbluehair", "kontolhat", "gawari", "rose3", "kisame", "kamesword", "amaketsu", "magicbook", "metalwing", "bluegirlhair", "devilkatana", "taxihat", "slipsword", "matrixshoes", "fireshoes", "wolfhead", "captainamerica2", "flowerfan", "helmet2", "doctorhair", "doctorglasses", "doctorglasses2", "kyubisword", "kyubihead", "kyubitie", "kyubishoes", "kyubiorb", "terminatormask", "anashat", "munirhat", "hassanhat", "fazalhat", "makuhat", "richyredhat", "richyredtie", "richyredvisky", "richyredshoes", "lemonjuice", "tastybread", "noobhelmet", "funtioningbrain", "santabeard2", "diamondclaws", "redkittenear", "bluebunnyhead", "bluebubblegum", "bluebunnymouth", "kingskin", "lawskin", "spskin", "hardvikinghelmet", "hardvikingbeard", "hardvikingsword", "hardvikingshoes", "tseriesskin", "pewdiepieskin", "bluesummerhat", "greensummerhat", "goldenhat", "active", "battlehelmet", "blackcepter", "blackclaws", "blackcrown", "blackeyes", "blacklordwings", "blackshoes", "blackwings", "darkwizardbeard", "darkwizardcepter", "darkwizardeyes", "darkwizardhat", "darkwizardshoes", "goldenshotgun", "greensummerglasses", "greenwintercap", "gskates", "iceskates", "magicsword", "neonbandana", "neoneyes", "neongun", "neonhelmet", "neonshoes", "purplesummercap", "purplesummerglasses", "snowball", "valueskin", "winterscarf" };
        public override void GameStarted()
        {
            // anything you write to the Console will show up in the
            PreloadPlayerObjects = true;
            // output window of the development server
            Console.WriteLine("Game is started");
        }
        public override void UserJoined(Player player)
        {
            var name = player.JoinData["name"];
            PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject main)
            {
                PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
                {
                    if (!playerobj.Contains("fbname") && !playerobj.Contains("level") && !playerobj.Contains("skin"))
                    {
                        playerobj.Set("fbname", player.JoinData["name"]);
                        playerobj.Set("outfit.hat", "");
                        playerobj.Set("outfit.glasses", "");
                        playerobj.Set("outfit.mouth", "");
                        playerobj.Set("outfit.hands", "");
                        playerobj.Set("outfit.shoes", "");
                        playerobj.Set("outfit.back", "");
                        playerobj.Set("donations", 0);
                        playerobj.Set("mp_lost", 0);
                        playerobj.Set("mp_permissions", 0);
                        playerobj.Set("achievements", new DatabaseArray());
                        playerobj.Set("progress_stats", new DatabaseArray());
                        playerobj.Set("news", new DatabaseArray());
                        playerobj.Set("challenges", new DatabaseArray());
                        playerobj.Set("mp_won", 0);
                        playerobj.Set("highscore", 0);
                        playerobj.Set("rounds", 0);
                        playerobj.Set("highscore_jumps", 0);
                        playerobj.Set("deals_today", 0);
                        playerobj.Set("level", 1);
                        playerobj.Set("prestige", 0);
                        playerobj.Set("xp", 0);
                        playerobj.Set("combo_highscore", 0);
                        playerobj.Set("last_played", DateTime.Now);
                        playerobj.Set("locale", "");
                        playerobj.Set("bg", "");
                        playerobj.Set("skin", "");
                        playerobj.Set("hs_ts", DateTime.Now.Year + "-" + (DateTime.Now.Month - 1) + "-" + DateTime.Now.Day);
                        playerobj.Set("cs_ts", DateTime.Now.Year + "-" + (DateTime.Now.Month - 1) + "-" + DateTime.Now.Day);
                        playerobj.Set("scchips", 0);
                        playerobj.Set("mp_permissions", 0);
                        playerobj.Set("sccs", "");
                        playerobj.Save();
                    }
                    if(player.PlayerObject.GetInt("highscore") > 9999)
                    {
                        playerobj.Set("highscore", 0);
                        playerobj.Save();
                    }
                    if (!main.Contains("online") || !main.Contains("banned") || !main.Contains("ban_reason") || !main.Contains("ban_days"))
                    {
                        main.Set("muted", DateTime.UtcNow);
                        main.Set("invite", false);
                        main.Set("inClan", false);
                        main.Set("ClanName", "");
                        main.Set("banned", false);
                        main.Set("ban_reason", "");
                        main.Set("ban_days", DateTime.Now);
                        main.Save();
                    }
                    
                    player.Send("pubmsg", "UserJoined");

                    if (main.GetBool("banned") != true)
                    {
                        
                    }
                    else
                    {
                        TimeSpan timeSpan2 = DateTime.Now - main.GetDateTime("ban_days");

                        var d2 = -timeSpan2.Days;
                        var d3 = -timeSpan2.Hours;
                        var d4 = -timeSpan2.Minutes;
                        var d5 = -timeSpan2.Seconds;
                        if (DateTime.Now >= main.GetDateTime("ban_days"))
                        {
                            main.Set("banned", false);
                            main.Set("ban_reason", "");
                            main.Set("ban_days", DateTime.Now);
                            main.Save();
                            player.Send("pubmsg", "unban", "Process");
                        }
                        else
                        {
                            player.Send("pubmsg", "isbanned", playerobj.GetString("ban_reason"), d2, d3, d4, d5);
                            player.Disconnect();
                            return;
                        };
                    }
                    PlayerIO.BigDB.LoadOrCreate("Active", player.ConnectUserId, delegate (DatabaseObject activedb)
                    {
                        Console.WriteLine("timer is working");
                        if (!activedb.Contains("id"))
                        {
                            activedb.Set("name", player.JoinData["name"]);
                            activedb.Set("id", player.ConnectUserId);
                            activedb.Set("time", 1);
                            activedb.Save();
                            Console.WriteLine("first time created db object");
                            return;
                        }
                    });
                });
            });
        }
        public override void UserLeft(Player player)
        {
            PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject main)
            {
                main.Set("online", false);
                main.Set("check", false);
                main.Save();
            });
        }
        public override void GotMessage(Player player, Message message)
        {
            PlayerIO.BigDB.LoadOrCreate("PlayerObjects", player.ConnectUserId, delegate (DatabaseObject playerobj)
            {
                PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject maindb)
                {
                    player.PayVault.Refresh(delegate ()
                    {
                        switch (message.Type)
                        {
                            case "ChangeSkin":
                                {
                                    playerobj.Set("skin", message.GetString(0));
                                    playerobj.Save();
                                }
                                break;
                            case "ChangeBG":
                                {
                                    if (message.GetString(0) != "")
                                    {
                                        if (player.PayVault.Has(message.GetString(0)))
                                        {
                                            playerobj.Set("bg", message.GetString(0));
                                            playerobj.Save();
                                        }
                                    }
                                    else
                                    {
                                        playerobj.Set("bg", "");
                                        playerobj.Save();
                                    }
                                }
                                break;
                            case "ChangeOutfit":
                                {
                                    if (message.GetString(1) != "")
                                    {
                                        playerobj.Set("outfit." + message.GetString(0), message.GetString(1));
                                        playerobj.Save();
                                    }
                                    else
                                    {
                                        playerobj.Set("outfit." + message.GetString(0), "");
                                        playerobj.Save();
                                    }
                                }
                                break;

                            case "newhigh":
                                {
                                    if (message.GetInt(0) <= 20000)
                                    {
                                        if (message.GetInt(0) > playerobj.GetInt("highscore"))
                                        {
                                            playerobj.Set("highscore", message.GetInt(0));
                                        }
                                        playerobj.Set("highscore_jumps", message.GetInt(1));
                                        playerobj.Set("hs_ts", DateTime.Now.Year + "-" + (DateTime.Now.Month - 1) + "-" + DateTime.Now.Day);
                                        playerobj.Save();
                                    }
                                    else
                                    {
                                        maindb.Set("banned", true);
                                        maindb.Set("ban_reason", "Hacking HighScore!");
                                        maindb.Set("ban_days", DateTime.Now.AddDays(2));
                                        maindb.Save();
                                        player.Send("pubmsg", "isbanned", maindb.GetString("ban_reason"), 2);
                                    }
                                }
                                break;
                            case "newbox":
                                if (message.GetInt(0) <= 500)
                                {
                                    playerobj.Set("combo_highscore", message.GetInt(0));
                                    playerobj.Set("cs_ts", DateTime.Now.Year + "-" + (DateTime.Now.Month - 1) + "-" + DateTime.Now.Day);
                                    playerobj.Save();
                                }
                                else
                                {
                                    maindb.Set("banned", true);
                                    maindb.Set("ban_reason", "Hacking BoxJump!");
                                    maindb.Set("ban_days", DateTime.Now.AddDays(2));
                                    maindb.Save();
                                    player.Send("pubmsg", "isbanned", maindb.GetString("ban_reason"), 2);
                                }
                                break;
                            case "openexchange":
                                PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject rrdb)
                                {
                                    PlayerIO.BigDB.LoadOrCreate("WeeklyExchange", "exchange", delegate (DatabaseObject we)
                                    {
                                        var myexpoint = rrdb.GetInt("exchangepoint", 0);
                                        var gottroll = rrdb.GetString("gottroll", "");
                                        var item1 = we.GetString("item1", "");
                                        var item2 = we.GetString("item2", "");
                                        var item3 = we.GetString("item3", "");
                                        var itemcost1 = we.GetInt("itemcost1", 0);
                                        var itemcost2 = we.GetInt("itemcost2", 0);
                                        var itemcost3 = we.GetInt("itemcost3", 0);
                                        var max1 = we.GetInt("max1", 0);
                                        var max2 = we.GetInt("max2", 0);
                                        var max3 = we.GetInt("max3", 0);
                                        player.Send("pubmsg", "opexchnow", myexpoint, item1, item2, item3, itemcost1, itemcost2, itemcost3, max1, max2, max3, gottroll);
                                    });
                                });
                                break;
                            case "changeex":
                                PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject rrdb)
                                {
                                    PlayerIO.BigDB.LoadOrCreate("WeeklyExchange", "exchange", delegate (DatabaseObject we)
                                    {
                                        var myexpoint = rrdb.GetInt("exchangepoint", 0);
                                        var item1 = we.GetString("item1", "");
                                        var item2 = we.GetString("item2", "");
                                        var item3 = we.GetString("item3", "");
                                        var itemcost1 = we.GetInt("itemcost1", 0);
                                        var itemcost2 = we.GetInt("itemcost2", 0);
                                        var itemcost3 = we.GetInt("itemcost3", 0);
                                        var max1 = we.GetInt("max1", 0);
                                        var max2 = we.GetInt("max2", 0);
                                        var max3 = we.GetInt("max3", 0);
                                        if (message.GetString(0) == "1" && myexpoint >= itemcost1 && max1 > 0)
                                        {
                                            rrdb.Set("exchangepoint", rrdb.GetInt("exchangepoint", 0) - itemcost1);
                                            we.Set("max1", we.GetInt("max1", 0) - 1);
                                            rrdb.Save();
                                            we.Save();
                                            List<BuyItemInfo> list = new List<BuyItemInfo>();
                                            list.Add(new BuyItemInfo(item1));
                                            BuyItemInfo[] list2 = list.ToArray();
                                            player.PayVault.Give(list2, delegate () { });
                                            player.Send("pubmsg", "alert", "Done!");
                                            var mypoint = rrdb.GetInt("exchangepoint", 0);
                                            player.Send("pubmsg", "showexpoint", mypoint);
                                        }
                                        else if (message.GetString(0) == "2" && myexpoint >= itemcost2 && max2 > 0)
                                        {
                                            rrdb.Set("exchangepoint", rrdb.GetInt("exchangepoint", 0) - itemcost2);
                                            we.Set("max2", we.GetInt("max2", 0) - 1);
                                            rrdb.Save();
                                            we.Save();
                                            List<BuyItemInfo> list = new List<BuyItemInfo>();
                                            list.Add(new BuyItemInfo(item2));
                                            BuyItemInfo[] list2 = list.ToArray();
                                            player.PayVault.Give(list2, delegate () { });
                                            player.Send("pubmsg", "alert", "Done!");
                                            var mypoint = rrdb.GetInt("exchangepoint", 0);
                                            player.Send("pubmsg", "showexpoint", mypoint);
                                        }
                                        else if (message.GetString(0) == "3" && myexpoint >= itemcost3 && max3 > 0)
                                        {
                                            rrdb.Set("exchangepoint", rrdb.GetInt("exchangepoint", 0) - itemcost3);
                                            we.Set("max3", we.GetInt("max3", 0) - 1);
                                            rrdb.Save();
                                            we.Save();
                                            List<BuyItemInfo> list = new List<BuyItemInfo>();
                                            list.Add(new BuyItemInfo(item3));
                                            BuyItemInfo[] list2 = list.ToArray();
                                            player.PayVault.Give(list2, delegate () { });
                                            player.Send("pubmsg", "alert", "Done!");
                                            var mypoint = rrdb.GetInt("exchangepoint", 0);
                                            player.Send("pubmsg", "showexpoint", mypoint);
                                        }
                                        else
                                        {
                                            player.Send("pubmsg", "alert", "Not enough!");
                                        }
                                    });
                                });
                                break;
                            case "checktroll":
                                PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject rrdb)
                                {
                                    var gottroll = rrdb.GetString("gottroll", "");
                                    if (gottroll == "" && gottroll != "yes")
                                    {
                                        rrdb.Set("gottroll", "yes");
                                        rrdb.Save();
                                        List<BuyItemInfo> list = new List<BuyItemInfo>();
                                        list.Add(new BuyItemInfo("trollface"));
                                        BuyItemInfo[] list2 = list.ToArray();
                                        player.PayVault.Give(list2, delegate () { });
                                        player.Send("pubmsg", "alert", "Lucky, You got free trollface!");
                                    }
                                    else
                                    {
                                        //do nothing
                                    }
                                });
                                break;

                            case "changemyitemtopoint":
                                PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject rrdb)
                                {
                                    var added = 0;
                                    foreach (var n in ultra)
                                    {
                                        if (n == message.GetString(0) && player.PayVault.Has(message.GetString(0)))
                                        {
                                            added = added + 1;
                                            player.PayVault.Consume(new VaultItem[] { player.PayVault.First(message.GetString(0)) }, delegate () { });
                                            rrdb.Set("exchangepoint", rrdb.GetInt("exchangepoint", 0) + 1);
                                            var mypoint = rrdb.GetInt("exchangepoint", 0);
                                            player.Send("pubmsg", "alert", "Done!");
                                            player.Send("pubmsg", "showexpoint", mypoint);
                                            rrdb.Save();
                                        }
                                    }
                                    if (added == 0)
                                    {
                                        var mypoint = rrdb.GetInt("exchangepoint", 0);
                                        player.Send("pubmsg", "showexpoint", mypoint);
                                        player.Send("pubmsg", "alert", "Please, select ultra!");
                                    }
                                });
                                break;
                            case "addcoins":
                                {
                                    if (message.GetInt(0) <= 20000)
                                    {
                                        player.PayVault.Credit((uint)message.GetInt(0), message.GetString(1), delegate () { player.Send("pubmsg", "coincallback"); });
                                    }
                                    else
                                    {
                                        maindb.Set("banned", true);
                                        maindb.Set("ban_reason", "Hacking Coins!");
                                        maindb.Set("ban_days", DateTime.Now.AddDays(2));
                                        maindb.Save();
                                        player.Send("pubmsg", "isbanned", maindb.GetString("ban_reason"), 2);
                                    }
                                }
                                break;
                            case "achievements":
                                {
                                    if (!playerobj.GetArray("achievements").Contains(message.GetString(0)))
                                    {
                                        if (message.GetString(0) == "donator")
                                        {
                                            player.PayVault.Give(new BuyItemInfo[] { new BuyItemInfo("donatorskin") }, delegate () { player.Send("pubmsg", "ItemRefresh"); });
                                        }
                                        var i = 0;
                                        DatabaseArray arr = playerobj.GetArray("achievements");
                                        DatabaseArray NewLibraryIndexArray = new DatabaseArray();
                                        for (i = 1; i <= arr.Count; i++)
                                        {
                                            NewLibraryIndexArray.Add(arr.GetString(i - 1));
                                        }
                                        NewLibraryIndexArray.Add(message.GetString(0));
                                        playerobj.Set("achievements", NewLibraryIndexArray);
                                        playerobj.Save();

                                    }
                                }
                                break;
                            case "selXP":
                                {
                                    if (playerobj.GetInt("level") == 30)
                                    {
                                        if (playerobj.GetInt("prestige") < 5)
                                        {
                                            playerobj.Set("xp", 0);
                                            playerobj.Set("level", 1);
                                            playerobj.Set("prestige", playerobj.GetInt("prestige") + 1);
                                            playerobj.Save();
                                            player.PayVault.Credit((uint)message.GetInt(0), message.GetString(1), delegate () { player.Send("pubmsg", "refresh"); });
                                            player.Send("pubmsg", "alert", "XP Sold, Please Reload!");
                                        }
                                        else
                                        {
                                            playerobj.Set("xp", 0);
                                            playerobj.Set("level", 1);
                                            playerobj.Set("prestige", 0);
                                            playerobj.Save();
                                            player.PayVault.Credit((uint)message.GetInt(0), message.GetString(1), delegate () { player.Send("pubmsg", "refresh"); });
                                            player.Send("pubmsg", "alert", "XP Sold, Please Reload!");
                                        }
                                    }
                                    else
                                    {
                                        player.Send("pubmsg", "alert", "Error Selling XP");
                                    }
                                }
                                break;
                            
                            case "addXP":
                                {
                                    if (message.GetInt(0) < 70000)
                                    {
                                        playerobj.Set("xp", playerobj.GetInt("xp") + message.GetInt(0));
                                        playerobj.Save();
                                    }
                                    else
                                    {
                                        maindb.Set("banned", true);
                                        maindb.Set("ban_reason", "Hacking XP!");
                                        maindb.Set("ban_days", DateTime.Now.AddDays(2));
                                        maindb.Save();
                                        player.Send("pubmsg", "isbanned", maindb.GetString("ban_reason"), 2);
                                    }
                                }
                                break;
                            case "levelup":
                                {
                                    if (message.GetInt(0) <= 30)
                                    {
                                        playerobj.Set("level", message.GetInt(0));
                                        playerobj.Save();
                                    }
                                    else
                                    {
                                        maindb.Set("banned", true);
                                        maindb.Set("ban_reason", "Hacking Stats!");
                                        maindb.Set("ban_days", DateTime.Now.AddDays(2));
                                        maindb.Save();
                                        player.Send("pubmsg", "isbanned", maindb.GetString("ban_reason"), 2);
                                    }
                                }
                                break;

                            case "usechip":
                                {
                                    if (playerobj.GetInt("sschips") < 1)
                                    {
                                        playerobj.Set("scchips", playerobj.GetInt("scchips") - 1);
                                        playerobj.Set("sccs", message.GetString(0));
                                        playerobj.Save();
                                    }
                                }
                                break;
                            case "scoredisp":
                                {
                                    if (message.GetInt(0) < playerobj.GetInt("combo_highscore"))
                                    {
                                        playerobj.Set("combo_highscore", message.GetInt(0));
                                        playerobj.Set("cs_ts", message.GetString(2));
                                        playerobj.Save();
                                    }
                                }
                                break;
                            case "unban":
                                player.Send("pubmsg", "unban", "done");
                                break;
                            case "clan":
                                {
                                    int x = 1;
                                    int y = 1;
                                    if (message.GetString(0) == "OpenClans")
                                    {
                                        PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject importDB)
                                        {
                                            if (!importDB.Contains("ClanName"))
                                            {
                                                importDB.Set("inClan", false);
                                                importDB.Set("ClanName", "");
                                                importDB.Save();
                                            }
                                            if (importDB.GetBool("inClan") != false)
                                            {
                                                PlayerIO.BigDB.LoadOrCreate("Clans", importDB.GetString("ClanName"), delegate (DatabaseObject clandb)
                                                {
                                                    string Members = "";
                                                    for (x = 1; x <= 26; x++)
                                                    {
                                                        if (clandb.GetString("MemberList.Member" + x, "") != "")
                                                        {
                                                            Members += clandb.GetString("MemberList.Member" + x) + ";";
                                                        }
                                                    }
                                                    var clanlevel = clandb.GetInt("ClanLevel", 1);
                                                    player.Send("pubmsg", "ClanOpen", true, clandb.GetString("ClanName"), clandb.GetString("ClanTag"), clandb.GetString("ClanLogo"), clandb.GetString("LogoColor"), clandb.GetString("ClanLeader"), clandb.GetInt("ClanLevel"), Members, clandb.GetString("ClanLeaderID"), clandb.GetString("ClanCoLeaderID"), clandb.GetString("ClanCoLeader"));
                                                });
                                            }
                                            else
                                            {
                                                player.Send("pubmsg", "ClanOpen", false);
                                            }
                                        });
                                    }
                                    else if (message.GetString(0) == "MakeClan")
                                    {
                                        PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject importDB)
                                        {
                                            if (player.PayVault.Coins >= 50000)
                                            {
                                                PlayerIO.BigDB.LoadOrCreate("Clans", message.GetString(3), delegate (DatabaseObject clandb)
                                                {
                                                    if (!clandb.Contains("exist"))
                                                    {
                                                        if (message.GetString(4).Contains("<"))
                                                        {
                                                            player.Send("pubmsg", "alert", "Clan Tag Contains Invalid Symbol", "Server");
                                                        }
                                                        else if (message.GetString(4).Length > 4)
                                                        {
                                                            player.Send("pubmsg", "alert", "Clan Tag Has maximum of 4 characters", "Server");
                                                        }
                                                        else
                                                        {
                                                            importDB.Set("inClan", true);
                                                            importDB.Set("ClanName", message.GetString(3));
                                                            clandb.Set("exist", true);
                                                            clandb.Set("ClanName", message.GetString(3));
                                                            clandb.Set("ClanTag", message.GetString(4));
                                                            clandb.Set("ClanLogo", message.GetString(1));
                                                            clandb.Set("LogoColor", message.GetString(2));
                                                            clandb.Set("ClanLevel", 1);
                                                            clandb.Set("ClanLeader", playerobj.GetString("fbname"));
                                                            clandb.Set("ClanLeaderID", player.ConnectUserId);
                                                            clandb.Set("ClanCoLeader", "");
                                                            clandb.Set("ClanCoLeaderID", "");
                                                            clandb.Set("ClanMemberCount", 0);
                                                            for (x = 1; x <= 26; x++)
                                                            {
                                                                clandb.Set("MemberList.Member" + x, "");
                                                                clandb.Set("MemberList.Member" + x + "_id", "");
                                                            }
                                                            importDB.Save();
                                                            clandb.Save();
                                                            player.PayVault.Debit((uint)20000, "Clan Create", delegate () { player.Send("pubmsg", "ClanMade"); });
                                                        }
                                                    }
                                                    else
                                                    {
                                                        player.Send("pubmsg", "alert", "Clan name already exists!");
                                                    }
                                                });
                                            }
                                            else
                                            {
                                                player.Send("pubmsg", "alert", "Not enough Coins!");
                                            }
                                        });
                                    }
                                    else if (message.GetString(0) == "LeaveClan")
                                    {
                                        PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject importDB)
                                        {
                                            PlayerIO.BigDB.LoadOrCreate("Clans", importDB.GetString("ClanName"), delegate (DatabaseObject clandb)
                                            {
                                                if (clandb.GetString("ClanLeaderID") == player.ConnectUserId)
                                                {
                                                    if (clandb.GetInt("ClanMemberCount") > 0)
                                                    {
                                                        if (clandb.GetString("ClanCoLeaderID") == "")
                                                        {
                                                            clandb.Set("ClanLeaderID", clandb.GetString("MemberList.Member1_id"));
                                                            clandb.Set("ClanLeader", clandb.GetString("MemberList.Member1"));
                                                            for (x = 1; x <= 26; x++)
                                                            {
                                                                if (x != 26)
                                                                {
                                                                    clandb.Set("MemberList.Member" + x, clandb.GetString("MemberList.Member" + (x + 1)));
                                                                    clandb.Set("MemberList.Member" + x + "_id", clandb.GetString("MemberList.Member" + (x + 1) + "_id"));
                                                                }
                                                                else
                                                                {
                                                                    clandb.Set("MemberList.Member26", "");
                                                                    clandb.Set("MemberList.Member26_id", "");
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            clandb.Set("ClanLeader", clandb.GetString("ClanCoLeader"));
                                                            clandb.Set("ClanLeaderID", clandb.GetString("ClanCoLeaderID"));
                                                            clandb.Set("ClanCoLeaderID", "");
                                                            clandb.Set("ClanCoLeader", "");
                                                            for (x = 1; x <= 26; x++)
                                                            {
                                                                if (clandb.GetString("ClanLeaderID") == clandb.GetString("MemberList.Member" + x + "_id"))
                                                                {
                                                                    for (y = x; y < 26; y++)
                                                                    {
                                                                        if (y != 26)
                                                                        {
                                                                            clandb.Set("MemberList.Member" + y, clandb.GetString("MemberList.Member" + (y + 1)));
                                                                            clandb.Set("MemberList.Member" + y + "_id", clandb.GetString("MemberList.Member" + (y + 1) + "_id"));
                                                                        }
                                                                        else
                                                                        {
                                                                            clandb.Set("MemberList.Member26", "");
                                                                            clandb.Set("MemberList.Member26_id", "");
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        clandb.Set("ClanMemberCount", clandb.GetInt("ClanMemberCount") - 1);
                                                        clandb.Save();
                                                    }
                                                    else
                                                    {
                                                        PlayerIO.BigDB.DeleteKeys("Clans", importDB.GetString("ClanName"));
                                                    }
                                                    importDB.Set("ClanName", "No Clan");
                                                    importDB.Set("inClan", false);
                                                    importDB.Save();
                                                }
                                                else
                                                {
                                                    if (clandb.GetString("ClanCoLeaderID") == player.ConnectUserId)
                                                    {
                                                        clandb.Set("ClanCoLeader", "");
                                                        clandb.Set("ClanCoLeaderID", "");
                                                    }
                                                    for (x = 1; x <= 26; x++)
                                                    {
                                                        if (clandb.GetString("MemberList.Member" + x + "_id") == player.ConnectUserId)
                                                        {
                                                            if (x != 26)
                                                            {
                                                                for (y = x; y < 26; y++)
                                                                {
                                                                    if (y != 26)
                                                                    {
                                                                        clandb.Set("MemberList.Member" + y, clandb.GetString("MemberList.Member" + (y + 1)));
                                                                        clandb.Set("MemberList.Member" + y + "_id", clandb.GetString("MemberList.Member" + (y + 1) + "_id"));
                                                                    }
                                                                    else
                                                                    {
                                                                        clandb.Set("MemberList.Member26", "");
                                                                        clandb.Set("MemberList.Member26_id", "");
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                clandb.Set("MemberList.Member26", "");
                                                                clandb.Set("MemberList.Member26_id", "");
                                                            }
                                                            clandb.Set("ClanMemberCount", clandb.GetInt("ClanMemberCount") - 1);
                                                            clandb.Save();
                                                            importDB.Set("ClanName", "No Clan");
                                                            importDB.Set("inClan", false);
                                                            importDB.Save();
                                                        }
                                                    }
                                                }
                                            });
                                        });
                                    }
                                    else if (message.GetString(0) == "upgradeclan")
                                    {
                                        PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject importDB)
                                        {
                                            PlayerIO.BigDB.LoadOrCreate("Clans", importDB.GetString("ClanName"), delegate (DatabaseObject clandb)
                                            {
                                                if (importDB.GetInt("dice") >= 50000)
                                                {
                                                    if (clandb.GetInt("ClanLevel") != 4)
                                                    {
                                                        if (clandb.GetInt("ClanLevel") == 2)
                                                        {
                                                            importDB.Set("dice", importDB.GetInt("dice") - 20000);
                                                            importDB.Save();
                                                            clandb.Set("ClanLevel", clandb.GetInt("ClanLevel") + 1);
                                                            clandb.Set("members.six", "");
                                                            clandb.Set("members.six_id", "");
                                                            clandb.Save();
                                                            player.Send("pubmsg", "alert", "Congratulations You are now Clan level " + clandb.GetInt("ClanLevel"), "Server");
                                                        }
                                                        else if (clandb.GetInt("ClanLevel") == 3)
                                                        {
                                                            importDB.Set("dice", importDB.GetInt("dice") - 20000);
                                                            importDB.Save();
                                                            clandb.Set("ClanLevel", clandb.GetInt("ClanLevel") + 1);
                                                            clandb.Set("members.seven", "");
                                                            clandb.Set("members.seven_id", "");
                                                            clandb.Save();
                                                            player.Send("pubmsg", "alert", "Congratulations You are now Clan level " + clandb.GetInt("ClanLevel"), "Server");
                                                        }
                                                        else
                                                        {
                                                            importDB.Set("dice", importDB.GetInt("dice") - 20000);
                                                            importDB.Save();
                                                            clandb.Set("ClanLevel", clandb.GetInt("ClanLevel") + 1);
                                                            clandb.Save();
                                                            player.Send("pubmsg", "alert", "Congratulations You are now Clan level " + clandb.GetInt("ClanLevel"), "Server");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        player.Send("pubmsg", "alert", "Your Clan Level is Higher", "Server");
                                                    }
                                                }
                                                else
                                                {
                                                    player.Send("pubmsg", "alert", "You need 50,000 Dice!", "Server");
                                                }
                                            });
                                        });
                                    }
                                    else if (message.GetString(0) == "makecoleader")
                                    {
                                        PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject importDB)
                                        {
                                            PlayerIO.BigDB.LoadOrCreate("Clans", importDB.GetString("ClanName"), delegate (DatabaseObject clandb)
                                            {
                                                if (clandb.GetString("ClanLeaderID") == player.ConnectUserId)
                                                {
                                                    for (x = 1; x <= 26; x++)
                                                    {
                                                        if (message.GetString(1) == clandb.GetString("MemberList.Member" + x))
                                                        {
                                                            clandb.Set("ClanCoLeader", clandb.GetString("MemberList.Member" + x));
                                                            clandb.Set("ClanCoLeaderID", clandb.GetString("MemberList.Member" + x + "_id"));
                                                            clandb.Save();
                                                            string Members = "";
                                                            for (x = 1; x <= 26; x++)
                                                            {
                                                                if (clandb.GetString("MemberList.Member" + x, "") != "")
                                                                {
                                                                    Members += clandb.GetString("MemberList.Member" + x) + ";";
                                                                }
                                                            }
                                                            var clanlevel = clandb.GetInt("ClanLevel", 1);
                                                            player.Send("pubmsg", "ClanOpen", true, clandb.GetString("ClanName"), clandb.GetString("ClanTag"), clandb.GetString("ClanLogo"), clandb.GetString("LogoColor"), clandb.GetString("ClanLeader"), clandb.GetInt("ClanLevel"), Members, clandb.GetString("ClanLeaderID"), clandb.GetString("ClanCoLeaderID"), clandb.GetString("ClanCoLeader"));
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    player.Send("pubmsg", "alert", "You're not the Clan Leader/Co-Leader", "Server");
                                                }
                                            });
                                        });
                                    }
                                    else if (message.GetString(0) == "kick")
                                    {
                                        PlayerIO.BigDB.LoadOrCreate("Main", player.ConnectUserId, delegate (DatabaseObject importDB)
                                        {
                                            PlayerIO.BigDB.LoadOrCreate("Clans", importDB.GetString("ClanName"), delegate (DatabaseObject clandb)
                                            {
                                                if (clandb.GetString("ClanLeaderID") == player.ConnectUserId || clandb.GetString("ClanCoLeaderID") == player.ConnectUserId)
                                                {
                                                    for (x = 1; x <= 26; x++)
                                                    {
                                                        if (message.GetString(1) == clandb.GetString("MemberList.Member" + x))
                                                        {
                                                            if (clandb.GetString("MemberList.Member" + x + "_id") != player.ConnectUserId)
                                                            {
                                                                PlayerIO.BigDB.LoadOrCreate("MainDB", clandb.GetString("MemberList.Member" + x + "_id"), delegate (DatabaseObject hisdb)
                                                                {
                                                                    hisdb.Set("inClan", false);
                                                                    hisdb.Set("ClanName", "");
                                                                    hisdb.Save();
                                                                });
                                                                if (clandb.GetString("MemberList.Member" + x + "_id") == clandb.GetString("ClanCoLeaderID"))
                                                                {
                                                                    clandb.Set("ClanCoLeader", "");
                                                                    clandb.Set("ClanCoLeaderID", "");
                                                                }
                                                                if (x != 22)
                                                                {
                                                                    for (y = x; y <= 26; y++)
                                                                    {
                                                                        if (y != 26)
                                                                        {
                                                                            clandb.Set("MemberList.Member" + y, clandb.GetString("MemberList.Member" + (y + 1)));
                                                                            clandb.Set("MemberList.Member" + y + "_id", clandb.GetString("MemberList.Member" + (y + 1) + "_id"));
                                                                        }
                                                                        else
                                                                        {
                                                                            clandb.Set("MemberList.Member26", "");
                                                                            clandb.Set("MemberList.Member26_id", "");
                                                                        }
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    clandb.Set("MemberList.Member26", "");
                                                                    clandb.Set("MemberList.Member26_id", "");
                                                                }
                                                            }
                                                            else
                                                            {
                                                                player.Send("pubmsg", "alert", "You can't kick Yourself", "Server");
                                                            }
                                                        }
                                                    }
                                                    clandb.Set("ClanMemberCount", clandb.GetInt("ClanMemberCount") - 1);
                                                    clandb.Save();
                                                    string Members = "";
                                                    for (x = 1; x <= 26; x++)
                                                    {
                                                        if (clandb.GetString("MemberList.Member" + x, "") != "")
                                                        {
                                                            Members += clandb.GetString("MemberList.Member" + x) + ";";
                                                        }
                                                    }
                                                    var clanlevel = clandb.GetInt("ClanLevel", 1);
                                                    player.Send("pubmsg", "ClanOpen", true, clandb.GetString("ClanName"), clandb.GetString("ClanTag"), clandb.GetString("ClanLogo"), clandb.GetString("LogoColor"), clandb.GetString("ClanLeader"), clandb.GetInt("ClanLevel"), Members, clandb.GetString("ClanLeaderID"), clandb.GetString("ClanCoLeaderID"), clandb.GetString("ClanCoLeader"));
                                                }
                                                else
                                                {
                                                    player.Send("pubmsg", "alert", "You're not the Clan Leader/Co-Leader", "Server");
                                                }
                                            });
                                        });
                                    }
                                }
                                break;
                        }
                    });
                });
            });
        }
    }
}
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...


Üst Alt