Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial MW3 weapons, perks, camos, attachments....
#31
Use xuid's.

Code:
public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // On say
        {
if (Message == "!gun") // If client says !gun then
            {
                if (Client.XUID == "yourxuid") // For specific player
                {
                    int Weapon = GetWeapon("iw5_ak47_mp_xmags_silencer_camo11"); // Gun ak47 attachments xmags and silencer, and also camo gold

                    Client.Other.PrimaryWeapon = Weapon; // PrimaryWeapon become ak47
                    Client.Ammo.PrimaryAmmoClip = +400; //You will receive +400 ammo

                    return ChatType.ChatNone; // No one can see that you said !gun
                }
            }

if (Message == "!getxuid") // If client says !gun then
            {
                   TellClient(Client.ClientNum, "Your XUID is " + Client.XUID, true); // Send's xuid to client ( Player who said !getxuid)
                    ServerPrint(Client.Name + "'s" + "XUID is " + Client.XUID); // Prints the Client name + xuid to console
            }
            return ChatType.ChatContinue; // Needs to be here, or it won't work I don't know why
        }

Easier to use is the WeaponBuilder made by @JariZ
http://www.itsmods.com/forum/Thread-Rele...opers.html

Goodluck
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#32
(12-25-2012, 16:51)99IRock Wrote: Use xuid's.

Code:
public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // On say
        {
if (Message == "!gun") // If client says !gun then
            {
                if (Client.XUID == "yourxuid") // For specific player
                {
                    int Weapon = GetWeapon("iw5_ak47_mp_xmags_silencer_camo11"); // Gun ak47 attachments xmags and silencer, and also camo gold

                    Client.Other.PrimaryWeapon = Weapon; // PrimaryWeapon become ak47
                    Client.Ammo.PrimaryAmmoClip = +400; //You will receive +400 ammo

                    return ChatType.ChatNone; // No one can see that you said !gun
                }
            }

if (Message == "!getxuid") // If client says !gun then
            {
                   TellClient(Client.ClientNum, "Your XUID is " + Client.XUID, true); // Send's xuid to client ( Player who said !getxuid)
                    ServerPrint(Client.Name + "'s" + "XUID is " + Client.XUID); // Prints the Client name + xuid to console
            }
            return ChatType.ChatContinue; // Needs to be here, or it won't work I don't know why
        }

Easier to use is the WeaponBuilder made by @JariZ
http://www.itsmods.com/forum/Thread-Rele...opers.html

Goodluck

Thank you so much, but here's another question, and how to make so that player automatically receive weapon at connection to the server?
Reply

#33
(12-25-2012, 17:52)SaviouR9966 Wrote: Thank you so much, but here's another question, and how to make so that player automatically receive weapon at connection to the server?

Make a .dsr file if you want it for every player. if you want to give the weapons only to specific XUID's you can do it like that:
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 OnPlayerSpawned(ServerClient Client)
  11. {
  12. int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want
  13. if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid
  14. {
  15. Client.Other.PrimaryWeapon = weapon;
  16. }
  17. }
  18. }
  19. }
Reply

#34
(12-25-2012, 20:28)8q4s8 Wrote:
(12-25-2012, 17:52)SaviouR9966 Wrote: Thank you so much, but here's another question, and how to make so that player automatically receive weapon at connection to the server?

Make a .dsr file if you want it for every player. if you want to give the weapons only to specific XUID's you can do it like that:
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 OnPlayerSpawned(ServerClient Client)
  11. {
  12. int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want
  13. if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid
  14. {
  15. Client.Other.PrimaryWeapon = weapon;
  16. }
  17. }
  18. }
  19. }
When I'm go in game, weapon which I put the it is given as the third, that is I have three weapon's, how to make so so weapons which I given have replaced the standard so that would it not was third?
Reply

#35
Add this to the code

Client.Other.CurrentWeapon = weapon;
Reply

#36
(12-26-2012, 17:51)8q4s8 Wrote: Add this to the code

Client.Other.CurrentWeapon = weapon;


It does not work, weapon just does not appear
Reply

#37
(12-26-2012, 22:46)SaviouR9966 Wrote:
(12-26-2012, 17:51)8q4s8 Wrote: Add this to the code

Client.Other.CurrentWeapon = weapon;


It does not work, weapon just does not appear
Reply

#38
(12-29-2012, 17:00)SaviouR9966 Wrote:
(12-26-2012, 22:46)SaviouR9966 Wrote:
(12-26-2012, 17:51)8q4s8 Wrote: Add this to the code

Client.Other.CurrentWeapon = weapon;


It does not work, weapon just does not appear

8Q4S8 code edited:
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 ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // Onsay event
  11. {
  12. if (Message == "!acr")
  13. {
  14. if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid
  15. {
  16. int acr = GetWeapon("iw5_acr_mp"); //any weapon you want
  17. Client.Other.PrimaryWeapon = acr;
  18. Client.Other.CurrentWeapon = acr;
  19. Client.Ammo.PrimaryAmmoClip = 1034; // Gives 1034 ammo
  20. return ChatType.ChatNone;// The message won't appear in chat
  21. }
  22. }
  23.  
  24. }
  25.  
  26. public override void OnPlayerSpawned(ServerClient Client)
  27. {
  28. int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want
  29. if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid
  30. {
  31. Client.Other.PrimaryWeapon = weapon; // The primary weapon will be weapon
  32. Client.Other.CurrentWeapon = weapon; // Your current weapon will be weapon
  33. }
  34. }
  35. }
  36. }

If it won't work on spawn, than test it with command !acr
If that one works and onspawn not than it's just something with onspawn
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#39
(12-29-2012, 17:07)99IRock Wrote:
(12-29-2012, 17:00)SaviouR9966 Wrote:
(12-26-2012, 22:46)SaviouR9966 Wrote:
(12-26-2012, 17:51)8q4s8 Wrote: Add this to the code

Client.Other.CurrentWeapon = weapon;


It does not work, weapon just does not appear

8Q4S8 code edited:
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 ChatType OnSay(String Message, ServerClient Client, bool Teamchat) // Onsay event
  11. {
  12. if (Message == "!acr")
  13. {
  14. if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid
  15. {
  16. int acr = GetWeapon("iw5_acr_mp"); //any weapon you want
  17. Client.Other.PrimaryWeapon = acr;
  18. Client.Other.CurrentWeapon = acr;
  19. Client.Ammo.PrimaryAmmoClip = 1034; // Gives 1034 ammo
  20. return ChatType.ChatNone;// The message won't appear in chat
  21. }
  22. }
  23.  
  24. }
  25.  
  26. public override void OnPlayerSpawned(ServerClient Client)
  27. {
  28. int weapon = GetWeapon("iw5_acr_mp"); //any weapon you want
  29. if (Client.XUID == xuid1 || Client.XUID == xuid2) //replace xuid
  30. {
  31. Client.Other.PrimaryWeapon = weapon; // The primary weapon will be weapon
  32. Client.Other.CurrentWeapon = weapon; // Your current weapon will be weapon
  33. }
  34. }
  35. }
  36. }

If it won't work on spawn, than test it with command !acr
If that one works and onspawn not than it's just something with onspawn

CurrentWeapon doesn't work OnPlayerSpawned I already tried it. Maybe you can remove primary and add it to a other weapon slot but i don't know if this will work
Reply

#40
(12-29-2012, 17:47)8q4s8 Wrote: CurrentWeapon doesn't work OnPlayerSpawned I already tried it. Maybe you can remove primary and add it to a other weapon slot but i don't know if this will work
How many weaponslots do we have, and how can I use them?
(Secondaryweapon and primaryweapon, but what more)
And wierd that currentweapon doesn't works.
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

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