Results 1 to 8 of 8

Thread: [CoD2] Weapon hit range

  1. #1
    Private
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Question [CoD2] Weapon hit range

    Hi,

    How can I set "kar98k"'s hit range? Is this enough if I set in eg.: weapons/kar98k_mp maxDamageRange?

    If the player's hit range > 2000 then print a text to the screen: "The hit range was too high"


    I don't know what the exact name is for this function but I might meant about shoot distance so if the distance was higher than for ex.: 1 meter then print "The distance was too high" to the screen?

    EDIT2: Sorry I wrote this topic in hurry and I know that my english isn't very well... Let's clarify what I want:

    I want to do a script, if the player shot within one meter then hits the enemy player else print that "The shooting distance was too high"...

    I don't want to beg for a free script but I really don't know how to start this...
    Last edited by Toxys; 1st November 2020 at 15:05.

  2. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    hm, i think: better do process dmg, distance and weap in callback
    PHP Code:
    codecallback_playerDamage(..., ..., ..., ...)
    {
        if (
    isDefined(self) && isDefined(eAttacker) && isPlayer(self) && isPlayer(eAttacker) && self != eAttacker && sWeapon == "kar98k_mp" && distance(self.origineAttacker.origin) > 1000)
        {
            
    eAttacker iprintlnbold("distance so long");
            return;
        }

    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  3. #3
    Private
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    2
    Thanked 3 Times in 3 Posts
    I need to set this in for ex.: sd.gsc right?

    I changed the Callback_PlayerDamage function to this but it doesn't seem to work. A little modification about my question: I wan't to print "distance so long" everytime if the player who is in "axis" side is shooting no matter if he is hitting the enemy player or no... just if the distance is longer than 1 meter print this. I hope you understand what I want to say.

    PHP Code:
    Callback_PlayerDamage(eInflictoreAttackeriDamageiDFlagssMeansOfDeathsWeaponvPointvDirsHitLocpsOffsetTime)
    {
    if (
    isDefined(self) && isDefined(eAttacker) && isPlayer(self) && isPlayer(eAttacker) && self != eAttacker && sWeapon == "kar98k_mp" && distance(self.origineAttacker.origin) > 1000)
        {
            
    eAttacker iprintlnbold("distance so long");
            return;
        }


  4. #4
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Quote Originally Posted by Toxys View Post
    I need to set this in for ex.: sd.gsc right?

    I changed the Callback_PlayerDamage function to this but it doesn't seem to work. A little modification about my question: I wan't to print "distance so long" everytime if the player who is in "axis" side is shooting no matter if he is hitting the enemy player or no... just if the distance is longer than 1 meter print this. I hope you understand what I want to say.

    PHP Code:
    Callback_PlayerDamage(eInflictoreAttackeriDamageiDFlagssMeansOfDeathsWeaponvPointvDirsHitLocpsOffsetTime)
    {
    if (
    isDefined(self) && isDefined(eAttacker) && isPlayer(self) && isPlayer(eAttacker) && self != eAttacker && sWeapon == "kar98k_mp" && distance(self.origineAttacker.origin) > 1000)
        {
            
    eAttacker iprintlnbold("distance so long");
            return;
        }

    Click image for larger version. 

Name:	48789.jpg 
Views:	1 
Size:	38.6 KB 
ID:	1642
    1. Add my code in function. NO REPLACE YOUR FUNCTION ONLY FOR MY CODE, just add MY code IN YOUR
    PHP Code:
    Callback_PlayerDamage(eInflictoreAttackeriDamageiDFlagssMeansOfDeathsWeaponvPointvDirsHitLocpsOffsetTime)
    {
    if (
    isDefined(self) && isDefined(eAttacker) && isPlayer(self) && isPlayer(eAttacker) && self != eAttacker && sWeapon == "kar98k_mp" && distance(self.origineAttacker.origin) > 1000)
        {
            
    eAttacker iprintlnbold("distance so long");
            return;
        }
    /* 

    ...

    code 

    ...

    */

    2. edit: change 1000 to 1, delete iprintlnbold
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  5. #5
    Private
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    2
    Thanked 3 Times in 3 Posts
    I didn't replaced the whole Callback_PlayerDamage function. Just added your code. But this is always displays "distance so long" no matter how far I shoot the enemy player.

    I want to display the "distance so long" message if the player shoot away more than 1 meter from itself no matter if hitting the enemy or no.

    One more question: Why I can't hit custom models? I can hit and kill the default american,german,russian, etc models... but if the enemy is choose for ex.: a brush model (e.g. brush_egypt_desert_1) I can't hit and kill him.

  6. #6
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Quote Originally Posted by Toxys View Post
    I didn't replaced the whole Callback_PlayerDamage function. Just added your code. But this is always displays "distance so long" no matter how far I shoot the enemy player.

    I want to display the "distance so long" message if the player shoot away more than 1 meter from itself no matter if hitting the enemy or no.

    One more question: Why I can't hit custom models? I can hit and kill the default american,german,russian, etc models... but if the enemy is choose for ex.: a brush model (e.g. brush_egypt_desert_1) I can't hit and kill him.
    do you need the distance between the player and the bullet point of impact?

    I don't know why this code doesn't work, how are you testing? maybe you always shoot at a distance of more than 1000?

    do test script for value 100-250. bcs 1 - very small value: maybe it's impossible distance between players.
    ?? 1meter != 1 from distance(); ??
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  7. #7
    Private
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    2
    Thanked 3 Times in 3 Posts
    No, I tested with different distances and always got that message.

  8. #8
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Quote Originally Posted by Toxys View Post
    No, I tested with different distances and always got that message.
    i think you do some wrong
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

Tags for this Thread

Posting Permissions

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