01-20-2012, 16:46
01-20-2012, 16:48
You might want to tell people what your problem is.
edit:
SetDvar("scr_dm_score_kill", " + NewXPValue");
should be
SetDvar("scr_dm_score_kill", NewXPValue);
edit:
SetDvar("scr_dm_score_kill", " + NewXPValue");
should be
SetDvar("scr_dm_score_kill", NewXPValue);
01-20-2012, 16:49
Didnt see the post ^^^ fail was going to say whats wrong with it?
01-20-2012, 16:51
(01-20-2012, 16:48)Pozzuh Wrote: [ -> ]You might want to tell people what your problem is.
edit:
SetDvar("scr_dm_score_kill", " + NewXPValue");
should be
SetDvar("scr_dm_score_kill", NewXPValue);
it gives me 2 errors, im in visual c# 2010
EDIT:
The best overloaded method match for 'Addon.CPlugin.SetDvar(string, string)' has some invalid arguments
AND
Argument 2: cannot convert from 'int' to 'string'
01-20-2012, 17:04
Try this
Code:
using Addon;
using System;
namespace xpmanager
{
public class xpmanager : CPlugin
{
public override void OnServerLoad()
{
ServerPrint("XP Manager V1 Loaded Successfully");
}
public override ChatType OnSay(string Message, ServerClient Client)
{
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 Kill XP Is: " + xp, true);
else
{
try
{
int NewXPValue = Convert.ToInt32(splitMsg[1]);
SetDvar("scr_dm_score_kill", NewXPValue);
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 HeadShot XP Is: " + hxp, true);
else
{
try
{
int NewHXPValue = Convert.ToInt32(splitMsg[1]);
SetDvar("scr_dm_score_headshot", "omg");
TellClient(Client.ClientNum, "^1HeadShot XP Changed To: " + NewHXPValue, true);
}
catch (Exception e)
{
TellClient(Client.ClientNum, "^1Invalid HeadShot XP Value!", true);
}
}
return ChatType.ChatNone;
}
return ChatType.ChatContinue;
}
private void SetDvar(string p, int NewXPValue)
{
throw new NotImplementedException();
}
}
}
(01-20-2012, 16:48)Pozzuh Wrote: [ -> ]SetDvar("scr_dm_score_kill", " + NewXPValue");Used that in the code above ^^^^
should be
SetDvar("scr_dm_score_kill", NewXPValue);
01-20-2012, 17:18
try
or just don't convert it to an integer... because the SetDvar function requires 2 strings .
Code:
SetDvar("scr_dm_score_kill", NewXPValue.ToString());
or just don't convert it to an integer... because the SetDvar function requires 2 strings .