Results 1 to 5 of 5

Thread: Disabling damage if player uses wrong weapon

  1. #1
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts

    Disabling damage if player uses wrong weapon

    Hey, I need to know how can I disable damage to the player if the attacker is using wrong weapon, for example if he needs to bash but he shoots at the victim.
    I think functions like isFiring() and isLookingAt() would help me do it, but whats the function to disable damage to the player that is being looked at, everything else I know already :P
    Thanks in advance.

  2. #2
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    if(sMeansofDeath != "MOD_MELEE")
    iDamage=0;

  3. The Following 2 Users Say Thank You to Ni3ls For This Useful Post:

    EvoloZz (15th March 2013),kung foo man (15th March 2013)

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    please use return; instead of idamage = 0;, as idamage gets checked further along the way.

  5. The Following 3 Users Say Thank You to IzNoGoD For This Useful Post:

    EvoloZz (15th March 2013),kung foo man (15th March 2013),Ni3ls (15th March 2013)

  6. #4
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    You want to make an bashmode?
    Code:
    if(getCvar("scr_bash") == "1" && sMeansOfDeath != "MOD_MELEE")
            return;
    Also if u just want to prevent damage on some weapons as example:
    Code:
    if(sWeapon == "mp44_mp")
          return;
    Also if you want to do like headshot does x2 or x3 damage, you can do the same
    Code:
    if(sHitLoc == "head" && sWeapon == "thompson_mp")
           iDamage = iDamage * 3;
    There are much ways how you can play with the damage thread, same way works if u want to prevent suicide with bazooka or grenades. Just test it out
    Last edited by Earliboy; 15th March 2013 at 19:06.
    No ... No ... this is not possible .......

  7. The Following 2 Users Say Thank You to Earliboy For This Useful Post:

    EvoloZz (15th March 2013),kung foo man (15th March 2013)

  8. #5
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    I have a bashmode already made, but atm it just removes ammo so I want to improve it to prevent bugs.
    Thanks for help guys

Posting Permissions

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