• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
change team names & score board color
#1
hi

guys i know in last some days i have some request but i i'm relay sorry for that.

guys i need a code to change team names but with that config for that :

[team name]
enable = true/false
teamname_allies = what you want!!
teamname_axis=what you want!!

And change score board color:

[score board color]
enable = true/false
team_allies = (color in name or hex)
team_axis=(color in name or hex)


Thank you Heart
  Reply
#2
Scoreboard not possible as of yet.
CSHARP Code
  1. using System;
  2. using System.Diagnostics;
  3. using Addon;
  4.  
  5. namespace ClassLibrary1
  6. {
  7. public class Class1:CPlugin
  8. {
  9. Stopwatch stop = new Stopwatch();
  10. public override void OnServerLoad()
  11. {
  12. stop.Start();
  13. SetDvars();
  14. base.OnServerLoad();
  15. }
  16. public override void OnServerFrame()
  17. {
  18. if (stop.Elapsed.Minutes == int.Parse(GetServerCFG("TeamName", "retry","20")))
  19. {
  20. stop.Reset();
  21. SetDvars();
  22. }
  23. base.OnServerFrame();
  24. }
  25. private void SetDvars()
  26. {
  27. if (GetServerCFG("TeamName", "teamname_allies", string.Empty)!=string.Empty && GetServerCFG("TeamName", "teamname_axis", string.Empty) != string.Empty)
  28. {
  29. SetDvar("g_TeamName_Allies", GetServerCFG("TeamName", "teamname_allies", "20"));
  30. SetDvar("g_TeamName_Axis", GetServerCFG("TeamName", "teamname_axis", "20"));
  31. }
  32. }
  33. public override void OnMapChange()
  34. {
  35. SetDvars();
  36. }
  37. public override void OnFastRestart()
  38. {
  39. SetDvars();
  40. }
  41. }
  42. }

Add to sv_config.ini
Code:
[TeamName]
enable = true
//or false
teamname_axis= demo
//teamname for axis
teamname_allies= demo2
//teamname for allies
retry=10
//minutes after which the dvar is automatically changed
Edit:1 Small error
[-] The following 2 users say Thank You to archit for this post:
  • d0h!, raminr63
  Reply
#3
Sad

Error 1 No overload for method 'Parse' takes '0' arguments

In here:


public override void OnServerFrame()
{
if (stop.Elapsed.Minutes == int.Parse())
{
stop.Reset();
SetDvars();
}
base.OnServerFrame();
}
  Reply
#4
Has an extra )
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply
#5
What?!!!!
  Reply
#6
(09-26-2012, 16:39)DidUknowiPwn Wrote: Has an extra )

Then this error pops up

Error 11 No overload for method 'Parse' takes 0 arguments C:\Users\test\documents\visual studio 2010\Projects\score_board\score_board\Class1.cs 18 41 score_board

if (stop.Elapsed.Minutes == int.Parse()) , remove it then Error 12 ) expected C:\Users\test\documents\visual studio 2010\Projects\score_board\score_board\Class1.cs 18 52 score_board
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

  Reply
#7
@archit

Plz help.

And also i sent you a pm plz answer to this.
  Reply
#8
(09-26-2012, 15:14)archit Wrote: Scoreboard not possible as of yet.
CSHARP Code
  1. using System;
  2. using System.Diagnostics;
  3. using Addon;
  4.  
  5. namespace ClassLibrary1
  6. {
  7. public class Class1:CPlugin
  8. {
  9. Stopwatch stop = new Stopwatch();
  10. public override void OnServerLoad()
  11. {
  12. stop.Start();
  13. SetDvars();
  14. base.OnServerLoad();
  15. }
  16. public override void OnServerFrame()
  17. {
  18. if (stop.Elapsed.Minutes == int.Parse(GetServerCFG("TeamName", "retry","20")))
  19. {
  20. stop.Reset();
  21. SetDvars();
  22. }
  23. base.OnServerFrame();
  24. }
  25. private void SetDvars()
  26. {
  27. if (GetServerCFG("TeamName", "teamname_allies", string.Empty)!=string.Empty && GetServerCFG("TeamName", "teamname_axis", string.Empty) != string.Empty)
  28. {
  29. SetDvar("g_TeamName_Allies", GetServerCFG("TeamName", "teamname_allies", "20"));
  30. SetDvar("g_TeamName_Axis", GetServerCFG("TeamName", "teamname_axis", "20"));
  31. }
  32. }
  33. public override void OnMapChange()
  34. {
  35. SetDvars();
  36. }
  37. public override void OnFastRestart()
  38. {
  39. SetDvars();
  40. }
  41. }
  42. }

Add to sv_config.ini
Code:
[TeamName]
enable = true
//or false
teamname_axis= demo
//teamname for axis
teamname_allies= demo2
//teamname for allies
retry=10
//minutes after which the dvar is automatically changed
Edit:1 Small error

OMG, really. Don't do that in this way. You are reading a file on every ServerFrame? :/

Btw: His code seems to be fine
[Image: compiling.png][Image: aLKA8og_460sa.gif]
  Reply
#9
The client requests the teamnames after he connected. Changing the dvar after that request won't change the teamnames (client side). So basically a change to the dvars in OnPlayerConnect would be enough I guess.
[Image: azuw.jpg]
  Reply
#10
Thank you @archit
Now its work perfectly.

But what about my pm?!!
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Call of Duty loser calls in SWAT team hoax on kid who beat him RaZ 3 1,363 04-24-2014, 19:31
Last Post: Casper
  Help Reset Score Low_BoB 3 1,052 11-07-2013, 16:47
Last Post: Yamato
  [Request] Anoying and bad names kicker! Misterio 1 682 10-15-2013, 09:41
Last Post: Nekochan
  Help Code color crosshairs koren30 3 1,463 10-02-2013, 19:26
Last Post: koren30
Question Help Team DAMAGE offhand E-losev 0 845 09-17-2013, 12:03
Last Post: E-losev
  Help choose 2 random players?(1 each team) 26hz 6 1,646 09-12-2013, 17:32
Last Post: Yamato
  Using Cheat Engine 6.2 to change BO2 address values wzlrsaur 6 4,171 08-06-2013, 06:28
Last Post: 14th
  Mw3 Feed Color Change?? aluzion 5 2,206 07-16-2013, 19:52
Last Post: barata
  Change death animation Keouf 3 1,169 07-05-2013, 18:39
Last Post: Nekochan
  [Request] Names, Chat and Scoreboard Mibbix 6 1,510 06-21-2013, 22:16
Last Post: Mibbix

Forum Jump:


Users browsing this thread: 1 Guest(s)