Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Checking slots smoke grenades and fragmentation.

  1. #1
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts

    Checking slots smoke grenades and fragmentation.

    How to check if a player has a grenade in your inventory?
    I mean the script.

    My code:

    if(self getWeaponSlotWeapon("primary") != "frags......." && self getWeaponSlotWeapon("primaryb") != "frags.......")
    {
    iprintlnbold("You have NADES!");
    }

    But not work....
    Please Help Me.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    you can use [code][/code] for code, thats more readable.

    please try:

    Code:
    player hasWeapon("frag_grenade_american_mp");
    player hasWeapon("frag_grenade_british_mp");
    player hasWeapon("frag_grenade_german_mp");
    player hasWeapon("frag_grenade_russian_mp");
    
    player hasWeapon("smoke_grenade_american_mp");
    player hasWeapon("smoke_grenade_british_mp");
    player hasWeapon("smoke_grenade_german_mp");
    player hasWeapon("smoke_grenade_russian_mp");

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    Moczulak (24th August 2012)

  4. #3
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    The script is correct. But if you take out all the grenades from the inventory to the next script shows have them.

  5. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    I dont understand the last sentence. ^^

    whats the "next script"?

    and how looks your current script?

  6. #5
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    if(self hasWeapon("frag_grenade_german_mp"))
    {
    self iprintln("^1You already have ^1[ ^7" + level.shop_weapons[id].name + " ^1] ^7!");
    }

    Good work but ,when i have 0 nades i see this text: self iprintln("^1You already have ^1[ ^7" + level.shop_weapons[id].name + " ^1] ^7!");

  7. #6
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Hm, okay, please try getWeaponSlotAmmo() and getWeaponSlotClipAmmo()

  8. #7
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    But nades not in slot prymary or prymaryb...

  9. #8
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    [21:01] IzNoGoD: GetWeaponAmmoClip( <weapon name> )

  10. #9
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    if(self getWeaponAmmoClip("frag_grenade_german_mp")) --> unknown function:

  11. #10
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    ok, please try getAmmoCount()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •