Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
one person juggernaut FIXED WITH CODE
#1
Information 
Hello guys i tried to make it so one player onthe allies team can get juggernaut it worked kinda but everyone could get it. here is code. And on map change it resets
Code:
int firstjugg = 0;
            if (Message == "!juggernaut")
            {
                if (Client.Team == Teams.Allies)
                {
                    if (firstjugg == 15)
                    {
                        TellClient(Client.ClientNum, "^1Juggernaut already taken", true);
                    }
                    else if (firstjugg == 0)
                    {
                        firstjugg = 15;
                        TellClient(Client.ClientNum, "You got jugger", true);
                        int fjugg = GetWeapon("riotshield_mp");
                        Client.Other.MaxHealth = 150;
                        Client.Other.Health = 1;
                        int fjugg1 = GetWeapon("iw5_p99_mp");
                        Client.Other.PrimaryWeapon = fjugg;
                        Client.Other.CurrentWeapon = fjugg;
                        Client.Other.SecondaryWeapon = fjugg1;
                    }
                }
                else if (Client.Team == Teams.Axis)
                {
                    TellClient(Client.ClientNum, "^1You cannot have juggernaut", true);
                }
            }

How i fixed it:

First make a global variable at the top
Code:
public class plugin_test : CPlugin
    {
        int firstjugg = 0;
Then i made a function called JuggerFunc having the first juggernaut code inside it
Code:
public void JuggerFunc(ServerClient Client)
         {
                        iPrintLnBold("^1|." + Client.Name + " Got juggernaut.|", null);
                        int fjugg = GetWeapon("riotshield_mp");
                        Client.Other.MaxHealth = 180;
                        Client.Other.Health = 180;
                        int fjugg1 = GetWeapon("iw5_p99_mp_silencer");
                        Client.Ammo.SecondaryAmmoClip = 35;
                        Client.Ammo.SecondaryAmmo = 10;
                        Client.Other.PrimaryWeapon = fjugg;
                        Client.Other.CurrentWeapon = fjugg;
                        Client.Other.CurrentWeapon = fjugg1;
                        Client.Other.SecondaryWeapon = fjugg1;
                        firstjugg = 15;
        }

Once i have done that i move on to OnChatSay (not sure exact name) then i do the if message:
Code:
{
                if (Message == "!juggernaut")
                {
                    if (firstjugg == 0)
                    {
                        JuggerFunc(Client);
                    }
                    else if (firstjugg == 15)
                    {
                        TellClient(Client.ClientNum, "^1Jugger already taken!", true);
                    }
                }
and i also made it so only survivors can use it
Code:
if (Client.Team == Teams.Allies)
            {
                if (Message == "!juggernaut")
                {
                    if (firstjugg == 0)
                    {
                        JuggerFunc(Client);
                    }
                    else if (firstjugg == 15)
                    {
                        TellClient(Client.ClientNum, "^1Jugger already taken!", true);
                    }
                }
            }
            else if (Client.Team == Teams.Axis)
            {
                if (Message == "!juggernaut")
                {
                    TellClient(Client.ClientNum, "^1You cant have jugger!", true);
                }
            }

Then i made it restart on map change:
Code:
public override void OnMapChange()
        {
            ServerPrint("Map changed!");
            firstjugg = 0;
        }

Thanks KungFu (not registerd user) for alot of help Smile
[Image: 24gu1a8.png]
Reply

#2
Noone can help me?
[Image: 24gu1a8.png]
Reply

#3
It doesn't work because it is setting the value only to the person who's typing the command. That means everyone else still got the value 0 and can use the command.
Reply

#4
Any way i can fix this? and i want it to reset on map change. Thanks.
[Image: 24gu1a8.png]
Reply

#5
i kinda get what you mean but kinda not
E: i didnt fully get it anyone can help with abit of code i dont wanna just get code but i dont really understand
[Image: 24gu1a8.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 4,016 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,549 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,313 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,133 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,683 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,639 07-28-2013, 01:52
Last Post: First_Semyon
Smile [Release] Map & Game Type Changer Plugin (Fixed) 30mba 31 21,885 07-10-2013, 16:27
Last Post: 26hz
  Code of vector Bloodfocus 1 2,411 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 5,617 04-20-2013, 15:06
Last Post: Nekochan
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 4,062 04-05-2013, 18:15
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

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