[HELP] Shared cash on shop system
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
Hello, i'm making a shop script for my server but the cash seems to be shared to everyone in the server, how do i fix that?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using InfinityScript; namespace HUD { public class hud : BaseScript { private int cash; private HudElem cashtxt; public hud() : base() { PlayerConnected += new Action(entity => { createPlayerHud(entity); }); } private void createPlayerHud(Entity player) { HudElem wep = HudElem.CreateFontString(player, "hudSmall", 0.7f); wep.SetPoint("TOP CENTER", "TOP CENTER", 0, 0); wep.HideWhenInMenu = true; HudElem cashtxt = HudElem.CreateFontString(player, "hudSmall", 1f); cashtxt.SetPoint("BOTTOM", "BOTTOM", 0, 0); cashtxt.SetText("^1Cash: ^2" + cash); OnInterval(1000, () => { wep.SetText("Weapon: " + player.CurrentWeapon); cashtxt.SetText("^1Cash: ^2" + cash); return true; }); } public override void OnSay(Entity player, string playerName, string text) { string[] arrChatMsg = text.Split(' '); if (arrChatMsg[0] == "!buy") { if (arrChatMsg[1] == "ac130") { if (cash >= 250) { player.Call("iprintlnbold", "^2Bought:^3 Walking AC130"); player.TakeAllWeapons(); player.GiveWeapon("ac130_25mm_mp"); player.SwitchToWeaponImmediate("ac130_25mm_mp"); cash -= 250; return; } else { player.Call("iprintlnbold", "^1Not Enought Cash"); } return; } if (arrChatMsg[1] == "wall") { if (cash >= 100) { player.Call("iprintlnbold", "^2Bought:^3 Wallhack"); player.Call("thermalvisionfofoverlayon"); cash -= 100; return; } else { player.Call("iprintlnbold", "^1Not Enought Cash"); } return; } if (arrChatMsg[1] == "hp") { if (cash >= 300) { player.Call("iprintlnbold", "^2Bought:^3 Super HP"); player.SetField("maxhealth", player.Health * 10); player.Health = player.Health * 10; cash -= 300; return; } else { player.Call("iprintlnbold", "^1Not Enought Cash"); } return; } return; } if (arrChatMsg[0] == "/rich") { cash += 1337; return; } } public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc) { if (attacker != player) { cash += 50; } if (attacker == player) { cash -= 50; } } } }