Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Freeze?
#1
Tongue 
Hey guys, i was thinking about a command which freeze u...
Like !freeze (nameuwant)
Can it be possible?, if its possible, can u make it to me? Thanks Big Grin
P.S my server its in 3.0 Tongue
Reply

#2
yea. i want one too Smile
and maybe the code of how to freeze an player.
Reply

#3
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace ClassLibrary1
  7. {
  8. public class Class1:CPlugin
  9. {
  10. public override void OnServerLoad()
  11. {
  12. ServerPrint("Freeze Plugin by 8Q4S8 loaded!");
  13. }
  14. public override ChatType OnSay(string Message, ServerClient Client)
  15. {
  16. if (Message.ToLower().StartsWith("!freeze"))
  17. {
  18. string[] split = Message.Split(' ');
  19. foreach (ServerClient c in GetClients())
  20. {
  21. if (c.Name.ToLower().Contains(split[1].ToLower()))
  22. {
  23. c.Other.ControlsFrozen = true;
  24. TellClient(Client.ClientNum, "^1" + c.Name + "^7 is frozen!", true);
  25. }
  26. }
  27. return ChatType.ChatNone;
  28. }
  29. else if (Message.ToLower().StartsWith("!unfreeze"))
  30. {
  31. string[] split = Message.Split(' ');
  32. foreach (ServerClient c in GetClients())
  33. {
  34. if (c.Name.ToLower().Contains(split[1].ToLower()))
  35. {
  36. c.Other.ControlsFrozen = false;
  37. TellClient(Client.ClientNum,"^1"+ c.Name+"^7 is unfrozen!", true);
  38. }
  39. }
  40. return ChatType.ChatNone;
  41. }
  42. return ChatType.ChatContinue;
  43. }
  44. }
  45. }


I didn't test the plugin, you can edit the code if you want.
Commads are !freeze and !unfreeze.


Attached Files
.zip   Freeze Plugin.zip (Size: 2.26 KB / Downloads: 15)
Reply

#4
Thx man. I'll test the code

it worked. thx again Smile
Reply

#5
(02-10-2013, 18:42)8q4s8 Wrote:
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Addon;
  5.  
  6. namespace ClassLibrary1
  7. {
  8. public class Class1:CPlugin
  9. {
  10. public override void OnServerLoad()
  11. {
  12. ServerPrint("Freeze Plugin by 8Q4S8 loaded!");
  13. }
  14. public override ChatType OnSay(string Message, ServerClient Client)
  15. {
  16. if (Message.ToLower().StartsWith("!freeze"))
  17. {
  18. string[] split = Message.Split(' ');
  19. foreach (ServerClient c in GetClients())
  20. {
  21. if (c.Name.ToLower().Contains(split[1].ToLower()))
  22. {
  23. c.Other.ControlsFrozen = true;
  24. TellClient(Client.ClientNum, "^1" + c.Name + "^7 is frozen!", true);
  25. }
  26. }
  27. return ChatType.ChatNone;
  28. }
  29. else if (Message.ToLower().StartsWith("!unfreeze"))
  30. {
  31. string[] split = Message.Split(' ');
  32. foreach (ServerClient c in GetClients())
  33. {
  34. if (c.Name.ToLower().Contains(split[1].ToLower()))
  35. {
  36. c.Other.ControlsFrozen = false;
  37. TellClient(Client.ClientNum,"^1"+ c.Name+"^7 is unfrozen!", true);
  38. }
  39. }
  40. return ChatType.ChatNone;
  41. }
  42. return ChatType.ChatContinue;
  43. }
  44. }
  45. }


I didn't test the plugin, you can edit the code if you want.
Commads are !freeze and !unfreeze.
Thank u so much !!!!!!!!
Its works Big GrinDD
Reply

#6
The above code is a bit verbose as your using the same code twice in the IF ELSE statement but only changing one thing in the TellClient method call, see the below which eliminates the redundant code and cleans things up.

CSHARP Code
  1. using Addon;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5.  
  6. namespace Freezer
  7. {
  8. public class Freezer : CPlugin
  9. {
  10. public override void OnServerLoad()
  11. {
  12. ServerPrint("Freeze Plugin by 8Q4S8 loaded!");
  13. }
  14.  
  15. public override ChatType OnSay(string Message, ServerClient Client)
  16. {
  17. string msg = Message.ToLower();
  18. string[] split = msg.Split(' ');
  19.  
  20. if (msg.StartsWith("!freeze") || msg.StartsWith("!unfreeze"))
  21. {
  22. bool isFrozen = msg.StartsWith("!freeze");
  23.  
  24. foreach (ServerClient c in GetClients())
  25. {
  26. if (c.Name.ToLower() == split[1] || c.Name.ToLower().Contains(split[1]))
  27. {
  28. c.Other.ControlsFrozen = isFrozen;
  29. TellClient(Client.ClientNum, string.Format("^1{0} ^7is {1}!", c.Name, (isFrozen ? "frozen" : "unfrozen")), true);
  30. }
  31. }
  32.  
  33. return ChatType.ChatNone;
  34. }
  35.  
  36. return ChatType.ChatContinue;
  37. }
  38. }
  39. }
I now host all my MW3 projects on my private GIT repo
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] Freeze Tag mod / plugins sgtnorton 1 2,354 06-29-2012, 17:50
Last Post: pollarpart
  [Request] Freeze Tag killdown 11 7,127 07-20-2011, 14:32
Last Post: Scripts18
  Freeze walking but not looking around? iAegle 8 4,764 06-01-2011, 22:11
Last Post: AZUMIKKEL

Forum Jump:


Users browsing this thread:
1 Guest(s)

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