• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Need Help with C# code
#1
I'm trying to make a plugin for my mw3 infected server that gives the infected extra health and speed. I looked all over this website for help but i couldnt find anything on it. If there is a thread on this that I somehow missed please direct me to it if not here's what I have i'm a noob at coding any help would be greatly appreciated

Code:
using System;
using Addon;
using System.Timers;

namespace plugin_test
{
    public class plugin_test : CPlugin
    {
        public override void  OnPlayerSpawned(ServerClient Client)
{
                if (Client.Team == Teams.Axis)
                {
                    Client.Other.MaxHealth = 250;
                    Client.Other.Health = 250;
                    Client.Other.SpeedScale = 2;
                    Client.Other.SetPlayerModel("mp_fullbody_opforce_juggernaut");
                }
            }
        }
    }
  Reply
#2
Your code should already do what you want but the speed does reset if you change weapon. Created a plugin with easy sv_config settings just for you.
I hope you aren't using tekno or I did this for nothing

CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using Addon;
  4. using System.Text;
  5.  
  6. namespace ClassLibrary1
  7. {
  8. public class Class1:CPlugin
  9. {
  10. int HealthAxis = 100;
  11. int HealthAllies = 100;
  12. float SpeedScaleAxis = 1;
  13. float SpeedScaleAllies = 1;
  14. public override void OnServerLoad()
  15. {
  16. HealthAxis = int.Parse(GetServerCFG("HEALTHandSPEED", "health_axis", ""));
  17. HealthAllies = int.Parse(GetServerCFG("HEALTHandSPEED", "health_allies", ""));
  18. SpeedScaleAxis = float.Parse(GetServerCFG("HEALTHandSPEED", "speedscale_axis", ""));
  19. SpeedScaleAllies = float.Parse(GetServerCFG("HEALTHandSPEED", "speedscale_allies", ""));
  20. }
  21. public override void OnPlayerSpawned(ServerClient Client)
  22. {
  23. if (Client.Team == Teams.Allies)
  24. Client.Other.Health = HealthAllies;
  25.  
  26. else if (Client.Team == Teams.Axis)
  27. Client.Other.Health = HealthAxis;
  28. }
  29. public override void OnAddonFrame()
  30. {
  31. foreach (ServerClient c in GetClients())
  32. {
  33. if (c.Other.isAlive == true)
  34. {
  35. if (c.Team == Teams.Allies)
  36. c.Other.SpeedScale = SpeedScaleAllies;
  37. else if (c.Team == Teams.Axis)
  38. c.Other.SpeedScale = SpeedScaleAxis;
  39. }
  40. }
  41. }
  42. }
  43. }


sv_config
Code:
[HEALTHandSPEED]
//axis = zombies, allies = survivors
//default health is 100 and default speedscale is 1
health_axis=200
health_allies=100
speedscale_axis=1.5
speedscale_allies=1
[-] The following 2 users say Thank You to 8q4s8 for this post:
  • Bandarigoda123, tubwux
  Reply
#3
Thank you soooooo much
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 1,917 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 3,839 09-01-2013, 18:30
Last Post: Bandarigoda123
  [Request] Compile this code please dozsa0 4 1,998 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 4,390 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 2,639 07-28-2013, 01:52
Last Post: First_Semyon
  Code of vector Bloodfocus 1 1,062 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 2,235 04-20-2013, 15:06
Last Post: Nekochan
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 1,970 04-05-2013, 18:15
Last Post: SuperNovaAO
Smile Help Help me with a code (who knows) NyZzE 2 1,150 04-05-2013, 01:47
Last Post: NyZzE
  Help error code [HARD] Tony. 2 1,494 03-23-2013, 00:19
Last Post: 8q4s8

Forum Jump:


Users browsing this thread: 1 Guest(s)