Helpp
#1
Anyone delete this thread already fixed Sleepy
Reply

#2
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);
[Image: MaEIQ.png]
Reply

#3
Didnt see the post ^^^ fail was going to say whats wrong with it?
Reply

#4
(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'
Reply

#5
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");

should be

SetDvar("scr_dm_score_kill", NewXPValue);
Used that in the code above ^^^^
Reply

#6
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 .
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.