Exemplo n.º 1
0
 public static bool BuyItem(int cost)
 {
     if (Globals.GameCoins >= cost)
     {
         Globals.GameCoins -= cost;
         BaseGamemode.WriteChat("Store", "Item bought.", 20, 200, 20);
         return(true);
     }
     else
     {
         BaseGamemode.WriteChat("Store", "Out of coins.", 200, 20, 20);
         return(false);
     }
 }
        public bool BuyItem(int cost)
        {
            dynamic gameCoins = GetPlayerDetail(LocalPlayer.ServerId, "coins");

            if (gameCoins == null)
            {
                gameCoins = 0;
            }
            ;
            if (gameCoins >= cost)
            {
                TriggerServerEvent("salty:netUpdatePlayerDetail", "coins", (int)gameCoins - 1);
                BaseGamemode.WriteChat("Store", "Item bought.", 20, 200, 20);
                return(true);
            }
            else
            {
                BaseGamemode.WriteChat("Store", "Out of coins.", 200, 20, 20);
                return(false);
            }
        }