using Addon;
using System;
using System.IO;
namespace xpmanager
{
public class xpmanagerclass : CPlugin
{
public override void OnServerLoad()
{
ServerPrint("XP Manager V1.75 Loaded Successfully. Author: slipknotignacio");
}
public override ChatType OnSay(string Message, ServerClient Client)
{
if (Message.StartsWith("!setupxp"))
{
if (GetDvar("scr_dm_score_kill") == "")
{
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
foreach (string file in files)
if (file.ToLower().EndsWith("server.cfg"))
Path = file;
string text = File.ReadAllText(Path) +
"\nseta scr_dm_score_kill \"100\"";
File.WriteAllText(Path, text);
TellClient(Client.ClientNum, "Kill XP fixed. You need to restart the map.", true);
}
else
{
TellClient(Client.ClientNum, "You dont need to setup Kill XP. Its OK.", true);
}
if (GetDvar("scr_dm_score_headshot") == "")
{
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
foreach (string file in files)
if (file.ToLower().EndsWith("server.cfg"))
Path = file;
string text = File.ReadAllText(Path) +
"\nseta scr_dm_score_headshot \"100\"";
File.WriteAllText(Path, text);
TellClient(Client.ClientNum, "HeadShot XP fixed. You need to restart the map.", true);
}
else
{
TellClient(Client.ClientNum, "You dont need to setup HeadShot XP. Its OK.", true);
}
if (GetDvar("scr_dm_score_suicide") == "")
{
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.cfg");
string Path = Directory.GetCurrentDirectory() + "/admin/server.cfg";
foreach (string file in files)
if (file.ToLower().EndsWith("server.cfg"))
Path = file;
string text = File.ReadAllText(Path) +
"\nseta scr_dm_score_suicide \"0\"";
File.WriteAllText(Path, text);
TellClient(Client.ClientNum, "Suicide XP fixed. You need to restart the map.", true);
}
else
{
TellClient(Client.ClientNum, "You dont need to setup Suicide XP. Its OK.", true);
}
return ChatType.ChatNone;
}
string lowMsg = Message.ToLower();
if (lowMsg.StartsWith("!xp"))
{
string[] splitMsg = lowMsg.Split(' ');
String xp = GetDvar("scr_dm_score_kill");
if (splitMsg.Length == 1)
TellClient(Client.ClientNum, "^1Your Current Kill XP Is: " + xp, true);
else
{
try
{
int NewXPValue = Convert.ToInt32(splitMsg[1]);
string qxp = NewXPValue.ToString();
SetDvar("scr_dm_score_kill", qxp);
TellClient(Client.ClientNum, "^1Kill XP Changed To: " + NewXPValue, true);
}
catch (Exception e)
{
TellClient(Client.ClientNum, "^1Invalid Kill XP Value!", true);
}
}
return ChatType.ChatNone;
}
if (lowMsg.StartsWith("!hxp"))
{
string[] splitMsg = lowMsg.Split(' ');
String hxp = GetDvar("scr_dm_score_headshot");
if (splitMsg.Length == 1)
TellClient(Client.ClientNum, "^1Your Current HeadShot XP Is: " + hxp, true);
else
{
try
{
int NewHXPValue = Convert.ToInt32(splitMsg[1]);
string qhxp = NewHXPValue.ToString();
SetDvar("scr_dm_score_headshot", qhxp);
TellClient(Client.ClientNum, "^1HeadShot XP Changed To: " + NewHXPValue, true);
}
catch (Exception e)
{
TellClient(Client.ClientNum, "^1Invalid HeadShot XP Value!", true);
}
}
return ChatType.ChatNone;
}
if (lowMsg.StartsWith("!sxp"))
{
string[] splitMsg = lowMsg.Split(' ');
String sxp = GetDvar("scr_dm_score_suicide");
if (splitMsg.Length == 1)
TellClient(Client.ClientNum, "^1Your Current Suicide XP Is: " + sxp, true);
else
{
try
{
int NewSuicideXPValue = Convert.ToInt32(splitMsg[1]);
string qsxp = NewSuicideXPValue.ToString();
SetDvar("scr_dm_score_suicide", qsxp);
TellClient(Client.ClientNum, "^1Suicide XP Changed To: " + NewSuicideXPValue, true);
}
catch (Exception e)
{
TellClient(Client.ClientNum, "^1Invalid Suicide XP Value!", true);
}
}
return ChatType.ChatNone;
}
return ChatType.ChatContinue;
}
}
}