Posts: 836
Threads: 48
Joined: Feb 2012
Reputation:
11
why does the Russian writing just come up as ????
Posts: 520
Threads: 29
Joined: Nov 2012
Reputation:
11
(02-12-2013, 09:46)hillbilly Wrote: why does the Russian writing just come up as ????
The ingame chat doesn't support russian language, I thought master131 sended a list of wich one do (I'm not sure)
Posts: 836
Threads: 48
Joined: Feb 2012
Reputation:
11
oh well i can't even get it to work anyway, no cmds work
Posts: 18
Threads: 6
Joined: Feb 2013
Reputation:
0
hey how do i change the default key from q to say, o or s
Posts: 63
Threads: 16
Joined: Nov 2012
Reputation:
0
Hey First you make one of the best plugins in this forum and second can you code for me that Admins can give some other People Points for weapons etc?
I hope you can help me
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
You have the source code just do some checks onplayerconnect then set your points.
Do not take life too seriously. You will never get out of it alive.
Posts: 63
Threads: 16
Joined: Nov 2012
Reputation:
0
(05-10-2013, 18:28)DidUknowiPwn Wrote: You have the source code just do some checks onplayerconnect then set your points.
Sry, but I cant do some (for you easy ) thing. So its would be nice when oyu can do this . Pls But Thx for the Answer;D
Posts: 63
Threads: 16
Joined: Nov 2012
Reputation:
0
(01-26-2013, 19:21)SailorMoon Wrote: Heey,
I made new unique shop system for Modern Warfare 3 - infected gametype.
Features:
* Easy to use
* Some kind of menu ( Press Q ( by default ) to see menu )
* Ability to add new items
* MySql Database
* Less code ( mk, who cares )
* New languages. This plugin supports russian and english languages.
* Obsuficated
How to add custom items?
Open items.txt file and write something like that:
Example
Code: addwep,<weaponname>,<cost>,<num>,<type>,<realname>,
To add perk you need to do this:
Code: addperk,<perkname>,<cost>,<num>,<realname>,
To set some parameters:
EXAMPLE
Code: set,xppoint,30, // xp points for kill
Code: addwep,iw5_mp5_mp,600,07,smg,MP5,
addwep,iw5_mp7_mp,1100,08,smg,MP7,
addwep,iw5_m4_mp,1000,09,ass,M4,
addwep,iw5_l96a1_mp,1800,10,snip,L96a1,
addwep,iw5_ksg_mp,1600,11,sg,KSG,
addwep,xm25_mp,4000,12,an,XM25,
addperk,specialty_marathon,13,1000,MARATHON,
set,xppoint,30,
Comma at end is REQURIED.
Type is created for subgroups in menu. Groups are: SMG, Assault, Shotgun, Sniper, Another(pistols, rpgs etc), and perks
Information
To toggle languages use !eng and !rus
To get information use !info
To get current points use !mp
To buy weapon see in-game menu.
You cannot edit zombie stuff for now.
Zombie stuff:
-More health
-More speed
-Throwing knife
-Juggernaut
Credits:
@Sailormoon - creator
@Ich1994 - database and weapon stuff ( refillammo, and statistics.cs class )
@DidUknowiPwn - 4done f*g & leecher
Download:
Please report any bugs
OK, There's source <3
Main.cs
Code: using System;
using System.Collections.Generic;
using Addon;
using System.IO;
namespace MoonShop
{
public class Shop : CPlugin
{
public string something = "AHAHHAHAHAHAHAHAHHAHAHA";
public Dictionary<String, String> menus = new Dictionary<String, String>();
public Dictionary<String, bool> isClassed = new Dictionary<String, bool>();
public Dictionary<String, String> Language = new Dictionary<String, String>();
private Dictionary<String, double> justSpawned = new Dictionary<string, double>();
// zoms
public Dictionary<String, float> speed = new Dictionary<String, float>();
public Dictionary<String, String> hpzom = new Dictionary<String, String>();
public Dictionary<String, bool> isJug = new Dictionary<string, bool>();
public Dictionary<int, int> Client_HudElem_Shop = new Dictionary<int, int>();
public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
{
int points = getPoints(Client.XUID);
ToDo(Client, Message, points);
return base.OnSay(Message, Client, Teamchat);
}
Statistics stats;
int pointstokill = 20;
public override int OnPlayerDamaged(ServerClient Attacker, ServerClient Victim, String Weapon, Int32 Damage, String DamageMod, HitLocations HitLocation)
{
if (Damage >= Victim.Other.Health && Attacker.Team != Victim.Team)
{
UpdatePoints(pointstokill, Victim);
}
return base.OnPlayerDamaged(Attacker, Victim, Weapon, Damage);
}
public override void OnServerLoad()
{
try
{
stats = new Statistics();
SV_Shop();
}
catch(Exception z)
{
ServerPrint(string.Format("[mShop - ENG]: I couldn't launch mShop plugin because error happened. {0}", z.Message));
ServerPrint(string.Format("[mShop - RUS]: mShop , . - {0}", z.Message));
}
base.OnServerLoad();
}
public override void OnAddonFrame()
{
Update();
base.OnAddonFrame();
}
public void UpdatePoints(int inc, ServerClient c)
{
stats.updatePoints(inc, c);
}
public int getPoints(String XUID)
{
return stats.Stats[XUID].Points;
}
public override void OnPlayerDisconnect(ServerClient client)
{
isClassed.Remove(client.XUID);
Language.Remove(client.XUID);
menus.Remove(client.XUID);
hpzom.Remove(client.XUID);
speed.Remove(client.XUID);
isJug.Remove(client.XUID);
deleteHUD(client);
}
public override void OnPlayerConnect(ServerClient client)
{
// default values
Language.Add(client.XUID, "eng");
menus.Add(client.XUID, "0");
speed.Add(client.XUID, 1);
isJug.Add(client.XUID, false); // nononononono
hpzom.Add(client.XUID, "100");
if (!stats.Stats.ContainsKey(client.XUID))
stats.insertNewPerson(client);
// heads up display
int clientshop = ShopMenu_HUD(client.ClientNum);
if (Client_HudElem_Shop.ContainsKey(client.ClientNum))
Client_HudElem_Shop[client.ClientNum] = clientshop;
else
Client_HudElem_Shop.Add(client.ClientNum, clientshop);
}
private int ShopMenu_HUD(int ClientNum)
{
HudElem hud = CreateNewHudElem();
hud.Type = HudElementTypes.Text;
hud.ShowToEnt = ClientNum;
hud.HideInMenu = true;
hud.Font = HudElementFonts.Default;
hud.FontScale = 1.1f;
hud.PointType = 81;
hud.OriginY = 189f;
hud.OriginX = 10f;
return hud.HudElementNum;
}
public void deleteHUD(ServerClient client)
{
if (Client_HudElem_Shop.ContainsKey(client.ClientNum))
{
HudElem kd = GetHudElement(Client_HudElem_Shop[client.ClientNum]);
kd.Type = HudElementTypes.None;
Client_HudElem_Shop.Remove(client.ClientNum);
}
}
public struct PerkInfo
{
public string perkname;
public string cost;
public string num;
public string perknamreal;
public PerkInfo(string wep, string costs, string numz, string fag)
{
perkname = wep;
cost = costs;
num = numz;
perknamreal = fag;
}
}
public struct WepInfo
{
public string wepname;
public string cost;
public string type;
public string num;
public string realname;
public WepInfo(string wep, string costs, string typez, string numz, string fag)
{
wepname = wep;
cost = costs;
type = typez;
num = numz;
realname = fag;
}
}
public Dictionary<String, WepInfo> shopdata = new Dictionary<string, WepInfo>();
public Dictionary<String, PerkInfo> perkdata = new Dictionary<string, PerkInfo>();
public void SV_Shop()
{
string init = File.ReadAllText(Directory.GetCurrentDirectory() + "/plugins/items.txt");
string[] lines = init.Split('\n');
foreach (string line in lines)
{
string[] item = line.Split(',');
// 0 - func
// 1 - item
// 2 - cost
// 3 - num
// 4 - type
if (item[0] == "addwep")
{
shopdata.Add(item[3], new WepInfo(item[1], item[2], item[4], item[3], item[5]));
ServerPrint("mShop: Added " + item[1] + " " + item[2] + " " + item[4] + " " + item[3]);
}
else if (item[0] == "addperk")
perkdata.Add(item[3], new PerkInfo(item[1], item[2], item[3], item[4]));
else if (item[0] == "set")
{
if (item[1] == "xppoint")
{
pointstokill = Convert.ToInt32(item[2]);
}
else
{
ServerPrint("mShop - Unknown parameter " + item[1]);
}
}
}
foreach (KeyValuePair<String, WepInfo> it in shopdata)
{
if (it.Value.type == "smg")
smg += "\n!" + it.Value.num + "-" + it.Value.realname + "[" + it.Value.cost + "]";
}
foreach (KeyValuePair<String, WepInfo> it in shopdata)
{
if (it.Value.type == "ass")
ass += "\n!" + it.Value.num + "-" + it.Value.realname + "[" + it.Value.cost + "]";
}
foreach (KeyValuePair<String, WepInfo> it in shopdata)
{
if (it.Value.type == "sg")
sg += "\n!" + it.Value.num + "-" + it.Value.realname + "[" + it.Value.cost + "]";
}
foreach (KeyValuePair<String, WepInfo> it in shopdata)
{
if (it.Value.type == "snip")
snip += "\n!" + it.Value.num + "-" + it.Value.realname + "[" + it.Value.cost + "]";
}
foreach (KeyValuePair<String, WepInfo> it in shopdata)
{
if (it.Value.type == "an")
an += "\n!" + it.Value.num + "-" + it.Value.realname + "[" + it.Value.cost + "]";
}
foreach (KeyValuePair<String, PerkInfo> it in perkdata)
{
p += "\n!" + it.Value.num + "-" + it.Value.perknamreal + "[" + it.Value.cost + "]";
}
// now tell us!
ServerPrint("[ENG]: mShop plugin was successfuly loaded!");
ServerPrint("[ENG#RUS] mShop Plugin - Created by SailorMoon ( itsmods.com )");
ServerPrint("[RUS]: mShop ....");
}
string smg = "";
string ass = "";
string sg = "";
string snip = "";
string an = "";
string p = "";
public void Update()
{
HudElem text;
List<ServerClient> clients;
clients = GetClients();
if (clients != null)
{
if (clients.Count > 0)
{
foreach (ServerClient client in GetClients())
{
if (client.Ping == 999)
continue;
if (client.Other.isAlive == true)
{
if (client.ConnectionState != ConnectionStates.MapLoading)
{
if (client.ConnectionState != ConnectionStates.Connecting)
{
if (client.ConnectionState != ConnectionStates.Zombie)
{
if (menus[client.XUID] == "1")
{
if (client.Other.ButtonPressed(Buttons.Reload))
{
menus[client.XUID] = "2";
}
else if (client.Other.ButtonPressed(Buttons.Prone))
{
menus[client.XUID] = "3";
}
else if (client.Other.ButtonPressed(Buttons.Activate))
{
menus[client.XUID] = "4";
}
else if (client.Other.ButtonPressed(Buttons.Knife))
{
menus[client.XUID] = "5";
}
else if (client.Other.ButtonPressed(Buttons.Crouch))
{
menus[client.XUID] = "6";
}
else if (client.Other.ButtonPressed(Buttons.Sprint))
{
menus[client.XUID] = "7";
}
}
// 1- allies
// 11 - axis
if (client.Other.ButtonPressed(Buttons.Equipment))
{
if (client.Team == Teams.Allies)
{
if (menus[client.XUID] == "1")
{
menus[client.XUID] = "0";
}
else
{
menus[client.XUID] = "1";
}
}
else if (client.Team == Teams.Axis)
{
if (menus[client.XUID] == "11")
{
menus[client.XUID] = "0";
}
else
{
menus[client.XUID] = "11";
}
}
}
text = GetHudElement(Client_HudElem_Shop[client.ClientNum]);
switch (menus[client.XUID])
{
case "0": // closed
if (Language[client.XUID] == "eng")
text.SetString("^2Q (equipment) key ^7-^3 Shop");
else if (Language[client.XUID] == "rus")
text.SetString("^2Q (.) ^7-^3 ");
break;
case "1": // choose list
if (Language[client.XUID] == "eng")
text.SetString("R(reload)-SMG\nC(prone)-Assault\nF(use)-Shotguns\nE(knife)-Snips\nCrouch-Another\nShift-Perks\nQ-Back");
else if (Language[client.XUID] == "rus")
text.SetString("R()-\nC()-..\nF(.)-\nE()-.\n-\nShift-\nQ-");
break;
// weps
case "2": // smg
text.SetString(smg + "\nQ - Back");
break;
case "3": // assault
text.SetString(ass + "\nQ - Back");
//text.SetString("!10 -M4[1000]\n!11 -M16[1100]\n!12 -FAD[1600]\n!13 -ACR[1700]\n!14 -T95[1600]\n!15 -M14[1700]\n!17 -G36[1500]\nQ-Back");
break;
case "4": // shotguns
text.SetString(sg + "\nQ - Back");
// text.SetString("!21 - KSG[1600]\n!22 - SPAS12[1700]\n!23 - USAS12[1650]\nQ - Back");
break;
case "5": // snipers
text.SetString(snip + "\nQ - Back");
// text.SetString("!18 - Barrett[900]\n!19 - MSR[1900]\n!20 - L96 [1800]\nQ - Back");
break;
case "6": // another
text.SetString(an + "\nQ - Back");
// text.SetString("!24 - XM25[4000]\n!26 - Desert Eagle[800]\nQ - Back");
break;
case "7": // perks
text.SetString(p + "\nQ - Back");
// text.SetString("!26-Marathon[1100]\n!27-Longer Sprint[1000]\n!28-FastReload[1400]\n!29-BulletAccuraty[1300]\nQ - Back");
break;
// axis
case "11":
text.SetString("!31 - Throwing Knife[500]\n!32 - JUGGERNAUT ZOMBIE[6000]\n!33-More speed[1000]\n!34- More HP[200]");
break;
}
}
}
}
}
}
}
}
}
public ChatType ToDo(ServerClient Client, string Message, int point)
{
try
{
// POINTS
int points = point;
if (Client.Team == Teams.Allies)
{
foreach (KeyValuePair<String, WepInfo> it in shopdata)
{
if (Message == "!" + it.Value.num)
{
if (getPoints(Client.XUID) >= Convert.ToInt32(it.Value.cost))
{
if (it.Value.type != "an")
GiveWeaponTo(Client, it.Value.wepname, false);
else
{
GiveWeaponTo(Client, it.Value.wepname, true);
}
UpdatePoints(-Convert.ToInt32(it.Value.cost), Client);
}
else
{
if (Language[Client.XUID] == "eng")
{
iPrintLnBold("^1No enough points!", Client);
}
else
{
iPrintLnBold("^1 !", Client);
}
}
return ChatType.ChatNone;
}
}
foreach (KeyValuePair<String, PerkInfo> it in perkdata)
{
if (Message == "!" + it.Value.num)
{
if (getPoints(Client.XUID) >= Convert.ToInt32(it.Value.cost))
{
Client.Other.SetPerk(GetPerk(it.Value.perkname));
UpdatePoints(-Convert.ToInt32(it.Value.cost), Client);
}
else
{
if (Language[Client.XUID] == "eng")
{
iPrintLnBold("^1No enough points!", Client);
}
else
{
iPrintLnBold("^1 !", Client);
}
}
return ChatType.ChatNone;
}
}
}
// -------------------------------------------------------------- //
if (Message == "!31")
{
if (Client.Team == Teams.Axis)
{
if (getPoints(Client.XUID) >= 500)
{
Client.Other.SetPerk(GetPerk("throwingknife_mp"));
Client.Other.EquipementDisabled = true;
Client.Other.EquipmentType = EquipementTypes.ThrowingKnife;
Client.Other.Equipment = GetWeapon("throwingknife_mp");
}
else
{
if (Language[Client.XUID] == "eng")
iPrintLnBold("^1No enough points :(", Client);
else
iPrintLnBold("^1 :(", Client);
}
}
return ChatType.ChatNone;
}
if (Message == "!32")
{
if (Client.Team == Teams.Axis)
{
if (getPoints(Client.XUID) >= 6000)
{
isJug[Client.XUID] = true;
// jug
Client.Other.SetPlayerModel("mp_fullbody_opforce_juggernaut");
hpzom[Client.XUID] = "1000";
Client.Other.Health = Convert.ToInt32(hpzom[Client.XUID]);
Client.Other.MaxHealth = Client.Other.Health;
}
else
{
if (Language[Client.XUID] == "eng")
iPrintLnBold("^1No enough points :(", Client);
else
iPrintLnBold("^1 :(", Client);
}
}
return ChatType.ChatNone;
}
if (Message == "!33")
{
if (Client.Team == Teams.Axis)
{
if (getPoints(Client.XUID) >= 1000)
{
speed[Client.XUID] = 1.2f;
Client.Other.SpeedScale = 1.2f;
}
else
{
if (Language[Client.XUID] == "eng")
iPrintLnBold("^1No enough points :(", Client);
else
iPrintLnBold("^1 :(", Client);
}
}
return ChatType.ChatNone;
}
if (Message == "!34")
{
if (Client.Team == Teams.Axis)
{
if (getPoints(Client.XUID) >= 2000)
{
hpzom[Client.XUID] = "210";
Client.Other.Health = Convert.ToInt32(hpzom[Client.XUID]);
Client.Other.MaxHealth = Client.Other.Health;
}
else
{
if (Language[Client.XUID] == "eng")
iPrintLnBold("^1No enough points :(", Client);
else
iPrintLnBold("^1 :(", Client);
}
}
}
// -----------------------------------------------------------------//
if (Message == "!info")
{
iPrintLnBold("Created by SailorMoon ( itsmods.com ), type !mp to get points, type !eng or !rus to toggle languages!", Client);
}
if (Message == "!rus")
{
Language[Client.XUID] = "rus";
iPrintLnBold(" .", Client);
return ChatType.ChatNone;
}
if (Message == "!eng")
{
Language[Client.XUID] = "eng";
iPrintLnBold("Language was switched!", Client);
return ChatType.ChatNone;
}
if (Message == "!mp")
{
switch (Language[Client.XUID])
{
case "rus":
iPrintLnBold(string.Format(" {0} !", getPoints(Client.XUID)), Client);
return ChatType.ChatNone;
break;
case "eng":
iPrintLnBold(string.Format("You have {0} points!", getPoints(Client.XUID)), Client);
return ChatType.ChatNone;
break;
}
}
if (Message == "!ABRA")
{
UpdatePoints(1000, Client);
}
return ChatType.ChatContinue;
}
catch (Exception z)
{
ServerPrint(z.Message);
return ChatType.ChatContinue;
}
return ChatType.ChatContinue;
}
public void GiveWeaponTo(ServerClient client, string weapon, bool issec)
{
if (issec == false)
{
int WepSecID = GetWeapon(weapon);
client.Other.SecondaryWeapon = WepSecID;
client.Other.CurrentWeapon = WepSecID;
int clip = 0;
int ammo = 0;
Weapons weap = new Weapons(this);
weap.refill(WepSecID, ref ammo, ref clip);
client.Ammo.SecondaryAmmo = ammo;
client.Ammo.SecondaryAmmoClip = clip * 2;
}
else if (issec == true)
{
int WepPist = GetWeapon(weapon);
client.Other.PrimaryWeapon = WepPist;
int clipsec = 0;
int ammosec = 0;
Weapons weap = new Weapons(this);
weap.refill(WepPist, ref ammosec, ref clipsec);
client.Ammo.PrimaryAmmo = ammosec;
client.Ammo.PrimaryAmmoClip = clipsec * 2;
}
}
}
}
Weapons.cs by @ Ich1994
Code: using System;
using System.Collections.Generic;
using System.Text;
using Addon;
namespace MoonShop
{
public class Weapons
{
public Dictionary<String, AmmoInfo> WeaponAmmo = new Dictionary<string, AmmoInfo>();
public Dictionary<int, String> WeaponInts = new Dictionary<int, String>(); // FILL THIS IN THE PLUGIN SOURCE SINCE HERE IS NO CHANE TO CALL GetWeapon.
public string[] weaponInt = { "iw5_p90_mp",
"iw5_mp7_mp",
"iw5_ak47_mp",
"iw5_acr_mp",
"iw5_pp90m1_mp",
"iw5_usas12_mp",
"iw5_fad_mp",
"iw5_ksg_mp",
"iw5_rsass_mp_rsassscope",
"iw5_ump45_mp",
"iw5_type95_mp",
"iw5_cm901_mp",
"iw5_scar_mp",
"iw5_g36c_mp",
"iw5_dragunov_mp_dragunovscope" };
public struct AmmoInfo
{
public int StartMagSize;
public int StartAmmo;
public AmmoInfo(int Ammo, int Mag)
{
StartMagSize = Mag;
StartAmmo = Ammo;
}
}
Shop s;
public Weapons(Shop pc)
{
s = pc;
WeaponAmmo.Add("iw5_p90_mp", new AmmoInfo(50, 100));
WeaponAmmo.Add("iw5_mp7_mp", new AmmoInfo(40, 80));
WeaponAmmo.Add("iw5_m9_mp", new AmmoInfo(25, 120));
WeaponAmmo.Add("iw5_mp5_mp", new AmmoInfo(32, 180));
WeaponAmmo.Add("iw5_ak47_mp", new AmmoInfo(30, 60));
WeaponAmmo.Add("iw5_acr_mp", new AmmoInfo(30, 60));
WeaponAmmo.Add("iw5_pp90m1_mp", new AmmoInfo(36, 72));
WeaponAmmo.Add("iw5_usas12_mp", new AmmoInfo(6, 36));//Standart is 6,30
WeaponAmmo.Add("iw5_spas12_mp", new AmmoInfo(6, 36));//Standart is 6,30
WeaponAmmo.Add("iw5_fad_mp", new AmmoInfo(40, 80));
WeaponAmmo.Add("iw5_ksg_mp", new AmmoInfo(12, 36));//Standart is 12,24
//WeaponAmmo.Add( "iw5_rsass_mp_rsasszoomscope",new AmmoInfo(20,30));//Standart is 20,20
WeaponAmmo.Add("iw5_rsass_mp", new AmmoInfo(20, 30));//Standart is 20,20
WeaponAmmo.Add("iw5_ump45_mp", new AmmoInfo(32, 64));
WeaponAmmo.Add("iw5_type95_mp", new AmmoInfo(30, 60));
WeaponAmmo.Add("iw5_cm901_mp", new AmmoInfo(30, 60));
WeaponAmmo.Add("iw5_scar_mp", new AmmoInfo(30, 60));
WeaponAmmo.Add("iw5_g36c_mp", new AmmoInfo(30, 60));
//WeaponAmmo.Add( "iw5_dragunov_mp_dragunovzoomscope", new AmmoInfo(10, 40));//Standart is 10,20
WeaponAmmo.Add("iw5_dragunov_mp", new AmmoInfo(10, 40));//Standart is 10,20
WeaponAmmo.Add("iw5_44magnum_mp", new AmmoInfo(6, 30));
WeaponAmmo.Add("iw5_striker_mp", new AmmoInfo(12, 36));//Standart is 12,24
WeaponAmmo.Add("iw5_p99_mp", new AmmoInfo(12, 24));
WeaponAmmo.Add("iw5_deserteagle_mp", new AmmoInfo(8, 16));
WeaponAmmo.Add("rpg_mp", new AmmoInfo(1, 10));
WeaponAmmo.Add("iw5_fnfiveseven_mp", new AmmoInfo(16, 32));
WeaponAmmo.Add("iw5_usp45_mp", new AmmoInfo(12, 24));
WeaponAmmo.Add("iw5_skorpion_mp", new AmmoInfo(20, 60));
foreach (KeyValuePair<String, Weapons.AmmoInfo> it in WeaponAmmo)
{
//pc.ServerPrint(pc.GetWeapon(it.Key) + " " + it.Key);
WeaponInts.Add(s.GetWeapon(it.Key), it.Key);
}
WeaponInts.Add(12329, "iw5_dragunov_mp"); // Integer if dragunov is in WeaponSlot
WeaponInts.Add(12332, "iw5_rsass_mp"); // Integer if rsass is in WeaponSlot
}
public void refill(int WeaponID, ref int Ammo, ref int AmmoClip)
{
String weaponname = WeaponInts[WeaponID];
refill(weaponname, ref Ammo, ref AmmoClip);
}
public void refill(String Weaponname, ref int Ammo, ref int AmmoClip)
{
AmmoInfo ai = WeaponAmmo[Weaponname];
int AmmoForClip = ai.StartMagSize + Int32.Parse(Ammo.ToString());
AmmoClip += AmmoForClip;
Ammo = ai.StartAmmo;
if (AmmoClip > ai.StartMagSize * 3)
AmmoClip = ai.StartMagSize * 3;
}
public void GiveWeapon(ServerClient client, int index)
{
int currentWeapon = client.Other.CurrentWeapon;
if (currentWeapon == client.Other.PrimaryWeapon)
{
int randomWeapon = s.GetWeapon(weaponInt[index]);
client.Other.PrimaryWeapon = randomWeapon;
client.Other.CurrentWeapon = randomWeapon;
int clip = 0;
int ammo = 0;
refill(randomWeapon, ref ammo, ref clip);
client.Ammo.PrimaryAmmo = ammo;
client.Ammo.PrimaryAmmoClip = clip;
}
else
{
int randomWeapon = s.GetWeapon(weaponInt[index]);
client.Other.SecondaryWeapon = randomWeapon;
client.Other.CurrentWeapon = randomWeapon;
int clip = 0;
int ammo = 0;
refill(randomWeapon, ref ammo, ref clip);
client.Ammo.SecondaryAmmo = ammo;
client.Ammo.SecondaryAmmoClip = clip;
}
}
}
}
Stats.cs by @Ich1994 ( i was lazy to write it myself )
Code: using System;
using System.Collections.Generic;
using System.IO;
using System.Data.SQLite;
using Addon;
namespace MoonShop
{
public struct StatElem
{
public String XUID;
public int Rank;
public int Points;
}
public class Statistics
{
public Dictionary<String, StatElem> Stats = new Dictionary<string, StatElem>();
SQLiteConnection connection;
public Statistics()
{
connection = new SQLiteConnection("Data Source=" + Directory.GetCurrentDirectory() + "/plugins/stats_mshop.stat");
connection.Open();
SQLiteCommand command = new SQLiteCommand("CREATE TABLE IF NOT EXISTS Statistics (XUID varchar(20),Rank integer,Points integer)", connection);
command.ExecuteNonQuery();
command.Dispose();
read();
}
~Statistics()
{
connection.Close();
}
private void read()
{
SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM Statistics", connection);
SQLiteDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
while (reader.Read())
{
StatElem newEntry = new StatElem();
newEntry.XUID = reader.GetString(reader.GetOrdinal("XUID"));
newEntry.Rank = reader.GetInt32(reader.GetOrdinal("Rank"));
newEntry.Points = reader.GetInt32(reader.GetOrdinal("Points"));
Stats.Add(newEntry.XUID, newEntry);
}
cmd.Dispose();
}
public void insertNewPerson(ServerClient c)
{
SQLiteCommand cmd = new SQLiteCommand("INSERT IGNORE INTO Statistics (XUID, Rank, Points)" +
"VALUES (\'" + c.XUID + "\', 1,0)", connection);
cmd.ExecuteNonQuery();
cmd.Dispose();
StatElem insert = new StatElem();
insert.Rank = 1;
insert.XUID = c.XUID;
Stats.Add(c.XUID, insert);
}
public void updatePoints(int Points, ServerClient c)
{
StatElem updated = Stats[c.XUID];
updated.Points += Points;
SQLiteCommand cmd = new SQLiteCommand("UPDATE Statistics SET Points=" + updated.Points + " WHERE XUID=\'" + updated.XUID + "\'", connection);
cmd.ExecuteNonQuery();
cmd.Dispose();
Stats[c.XUID] = updated;
}
}
}
How do I change the key to open the shop to !weapon??
Posts: 74
Threads: 2
Joined: Mar 2013
Reputation:
6
05-12-2013, 18:24
(This post was last modified: 05-12-2013, 18:24 by X-Track.)
(05-12-2013, 17:17)Hallla Wrote: How do I change the key to open the shop to !weapon??
i didn't read the hole code but i think its something with change the if (client.Other.ButtonPressed(Buttons.Equipment)) to if (Message.ToLower().StartsWith("!weapons")) but i am not sure ^^
good-luck, X-Track
Posts: 14
Threads: 3
Joined: Dec 2012
Reputation:
0
Hey Sailormoon. First nice job. Second Im moderating a server which got a shop system but would you mind to maybe share this code. Im a beginner and it could be funny to try. Btw if any of you guys needs help about boxes then Im a pro on that part as I make spots for the servers too. Just ask.
Mibbix (Steam name - Mibbix)
|