ItsMods

Full Version: Problem with compiling mw3 server plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,
I want to change team names
I write this code in C# but show same error in error list (Error1 A namespace cannot directly contain members such as fields or methods)

Code:
SetDvar("g_teamname_allies", "^2OTHERS");
SetDvar("g_teamname_axis", "^1H^7e^1R^7o^1S");
can anyone compile this code ?
sorry for my bad englishBlush
tnx
(08-08-2012, 06:56)king_siavash Wrote: [ -> ]Hi guys,
I want to change team names
I write this code in C# but show same error in error list (Error1 A namespace cannot directly contain members such as fields or methods)

Code:
SetDvar("g_teamname_allies", "^2OTHERS");
SetDvar("g_teamname_axis", "^1H^7e^1R^7o^1S");
can anyone compile this code ?
sorry for my bad englishBlush
tnx

it looks like you have defined a namespace and directly a method inside that.. You mustn't do that.

Here is a Example on how a Plugin should look like (main class):

CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace YourNameSpace
  7. {
  8. //Classes here
  9. public class YourClass : CPlugin
  10. {
  11. //Methods/Variables here
  12. public string justAVariable = "test";
  13.  
  14. public override void OnMapChange()
  15. {
  16. SetDvar("g_teamname_allies", "^2OTHERS");
  17. SetDvar("g_teamname_axis", "^1H^7e^1R^7o^1S");
  18. }
  19. }
  20. }