![]() |
|
Helpp - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: Helpp (/Thread-Helpp.html) |
Helpp - kokole - 01-20-2012 Anyone delete this thread already fixed
RE: Helpp - Pozzuh - 01-20-2012 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); RE: Helpp - Tylerd86 - 01-20-2012 Didnt see the post ^^^ fail was going to say whats wrong with it? RE: Helpp - kokole - 01-20-2012 (01-20-2012, 16:48)Pozzuh Wrote: You might want to tell people what your problem is. 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' RE: Helpp - Tylerd86 - 01-20-2012 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 ^^^^ RE: Helpp - iAegle - 01-20-2012 try Code: SetDvar("scr_dm_score_kill", NewXPValue.ToString());or just don't convert it to an integer... because the SetDvar function requires 2 strings . |