• 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Create plugins
#21
Thanks, I understood as to increase damage at the weapon (I made strengthened deagle), but for me still remain unclear how to make it:
Undecided
(01-20-2013, 10:42)ltybcs Wrote: How to make so that on each card there was a different weapon, on outpost for example rsass, on seatown for example usp.45 and so on, and whether it is possible to make that I had a weapon not such as at all, when at all usp.45 at me for example p90?

Please, you can explain in more detail
  Reply
#22
(01-20-2013, 10:42)ltybcs Wrote: I had a weapon not such as at all,when at all usp.45 at me for example p90?
Can't understand what you mean there as for your other questions first I use the onPlayerSpawned event which is fired every time a player spawns.Next I create a timer because ,for me at least ,assigning weapons at spawn doesn't work.Then I check for the map using GetDvar("mapname") and if it equals mp_dome I proceed to see the team.Next I get the weapon ID because PrimaryWeapon takes int not string then I assign the weapon ID to primary and current weapon as for zombies ,I also change ammo to make sure they don't have any ammo
  Reply
#23
I guess he means this.
Use onplayerspawned

base.OnPlayerSpawned(Client);
}
Code:
public override void OnPlayerSpawned(ServerClient Client)
        {
Than this for what map
Code:
string map = GetDvar("mapname");

            if (map == "mp_dome") // This is for map dome
            {
                
             int iWeaponID = GetWeapon("iw5_aa12_mp_grip_xmags_camo08");

                    Client.Other.PrimaryWeapon = iWeaponID; // Sets primary weapon to iWeaponID (aa12)
                    Client.Ammo.PrimaryAmmoClip = +50; //Gives the clip of primary weapon +50
                    Client.Ammo.PrimaryAmmo = +2000; // Gives 2000 ammo (If you reload you take ammo from this 2000)
            }
if (Client.XUID == "YourXUID") // Put in your xuid there , so you get the ump45 instead of the aa12
                {
                    int iWeaponID = GetWeapon("iw5_ump45_mp_silencer_xmags_rof_camo08");

                    Client.Other.PrimaryWeapon = iWeaponID;
                    Client.Ammo.PrimaryAmmoClip = +400;
                    Client.Ammo.PrimaryAmmo = +400;
                }
        }

I guess this is what you need?
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
[-] The following 1 user says Thank You to 99IRock for this post:
  • ltybcs
  Reply
#24
Yes, that I looked for this that, many thanks archit and 99IRock for the help
Smile
  Reply
#25
Rock did you test the functions?
  Reply
#26
Yes, the code works but I have with it a small problem. At me in a code which below under a spoiler when I come into the game Deagle it is added by the 3rd weapon instead of replaces the basic.

How to replace the main weapon with Deagle and that it wasn't the 3rd weapon?

  Reply
#27
Nobody can help me?
Undecided
  Reply
#28
Using onsay can fix it, I don't know why it does this on spawn..
If you use onsay and than a message like !deagle, and then let it spawn deagle it will work fine
You can also try to do this :
Client.Other.CurrentWeapon = weapon;

I don't know if it will work.
(and if currentweapon is spelled correctly (The high letters C and W))
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
  Reply
#29
currentweapon doesn't work with OnPlayerSpawned, you have to use a timer and then give the weapon to the player 1 or 2 seconds after spawn.

I found this code somewhere on itsmods, I think that should work too
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. Dictionary<int, int> ProcessSpawn = new Dictionary<int, int>();
  11. public override void OnPlayerSpawned(ServerClient Client)
  12. {
  13. ProcessSpawn.Add(Client.ClientNum, 1/*seconds*/ * 1000 / AddonFrameInterval);
  14. }
  15.  
  16. public override void OnAddonFrame()
  17. {
  18. List<int> PSKeys = new List<int>(ProcessSpawn.Keys);
  19. foreach (int key in PSKeys)
  20. {
  21. ProcessSpawn[key]--;
  22. if (ProcessSpawn[key] == 0)
  23. {
  24. ServerClient Client = GetClient(key);
  25. if (Client.Team == Teams.Allies)
  26. {
  27. if (Client.XUID == "xxxxxxxxxxxxxxxx")
  28. {
  29. int weap = GetWeapon("iw5_acr_mp");
  30. Client.Other.PrimaryWeapon = weap;
  31. Client.Other.CurrentWeapon = weap;
  32. }
  33. }
  34. ProcessSpawn.Remove(key);
  35. }
  36. }
  37. }
  38. }
  39. }
[-] The following 1 user says Thank You to 8q4s8 for this post:
  • ltybcs
  Reply
#30

Thanks, this script works and considerably reduces the code size as it isn't necessary to register the weapon on each card.
Smile
I also added
Client.Other.CurrentWeapon = weapon;
And now the weapon replaces the basic, instead of creates the 3rd for what separate gratitude
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Plugins are not working clemi555 7 1,553 11-03-2013, 10:55
Last Post: d0h!²
  MW3 Plugins Arcane 1 1,211 10-19-2013, 10:30
Last Post: Nekochan
  Who can create this script First_Semyon 3 1,669 09-24-2013, 18:19
Last Post: First_Semyon
  [Request] Request for !afk and !balance plugins. UlTiiMaTuM 3 1,312 09-10-2013, 02:13
Last Post: UlTiiMaTuM
  Help need help?how to make plugins code hXnarutoXone 12 3,046 09-01-2013, 18:30
Last Post: Bandarigoda123
  ╔►FREE HELP SERVICE◄╗ ✯ Minecraft ✯ Plugins ✯ Help ✯ Support ✯ KrypTiK 14 4,982 07-23-2013, 22:21
Last Post: KrypTiK
Question Help what program, open and edit plugins ??? lexa__33 1 1,172 06-24-2013, 09:36
Last Post: EnVi Sweden Rocks
  Server addon & plugins pflaurie 5 2,217 03-19-2013, 03:31
Last Post: hillbilly
Smile Help Updated plugins please NyZzE 0 837 03-04-2013, 22:39
Last Post: NyZzE
Video [Tutorial] (Video) How to create the Beretta (or any CoD4's weapon) in Black Ops hitmax 19 5,936 02-08-2013, 00:18
Last Post: Gamemaster20

Forum Jump:


Users browsing this thread: 1 Guest(s)