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

Code:
using System; using System.Collections.Generic; using Addon; using System.Text; namespace ClassLibrary1 { public class Class1:CPlugin { int HealthAxis = 100; int HealthAllies = 100; float SpeedScaleAxis = 1; float SpeedScaleAllies = 1; public override void OnServerLoad() { HealthAxis = int.Parse(GetServerCFG("HEALTHandSPEED", "health_axis", "")); HealthAllies = int.Parse(GetServerCFG("HEALTHandSPEED", "health_allies", "")); SpeedScaleAxis = float.Parse(GetServerCFG("HEALTHandSPEED", "speedscale_axis", "")); SpeedScaleAllies = float.Parse(GetServerCFG("HEALTHandSPEED", "speedscale_allies", "")); } public override void OnPlayerSpawned(ServerClient Client) { if (Client.Team == Teams.Allies) Client.Other.Health = HealthAllies; else if (Client.Team == Teams.Axis) Client.Other.Health = HealthAxis; } public override void OnAddonFrame() { foreach (ServerClient c in GetClients()) { if (c.Other.isAlive == true) { if (c.Team == Teams.Allies) c.Other.SpeedScale = SpeedScaleAllies; else if (c.Team == Teams.Axis) c.Other.SpeedScale = SpeedScaleAxis; } } } } }

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
Reply

#3
Thank you soooooo much
Reply



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

Forum Jump:


Users browsing this thread:
1 Guest(s)

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