Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: COD2 camper script

  1. #11
    Private
    Join Date
    Apr 2021
    Posts
    16
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by maxdamage99 View Post

    PHP Code:
    self thread scriptfolder/_camper::checkLoop(); 
    Thankssss !! it's work..

    ////

    I wrote the following to interfere with the camp times from the console. The script is running, but I cannot interfere with the times from the console.what to do for this.

    PHP Code:
            level.campradius 170;
        if (
    getcvar("campradius")!= "" && getcvarint("campradius") > 400)
        
    level.campradius getcvarint("campradius");
        
           
    level.campsecswarn 5;
        if (
    getcvar("campsecswarn")!= "" && getcvarint("campsecswarn") > 20)
        
    level.campsecswarn getcvarint("campsecswarn");
        
        
    level.campsecspunish 9;
        if (
    getcvar("campsecspunish")!= "" && getcvarint("campsecspunish") > 20)
        
    level.campsecspunish getcvarint("campsecspunish"); 

  2. The Following User Says Thank You to girdap For This Useful Post:

    kung foo man (24th June 2021)

  3. #12
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    add in checkLoop()
    PHP Code:
        /* ... */

        //ALL "CAMP_SECS_*" vars must be multiples of "waitTime" (4 / 0.1 & 6 / 0.1 == true => good)
        
    CAMP_RADIUS level.campradius
        
    CAMP_SECS_WARN level.campsecswarn;
        
    CAMP_SECS_PUNISH level.campsecspunish;

        
    /* ... */ 
    i think this better:

    PHP Code:
        level.campradius 170;
        if (
    getcvar("campradius")!= "" && getcvarint("campradius") > 400)
        
    level.campradius getcvarint("campradius");
        
        
    level.campsecswarn 5;
        if (
    getcvar("campsecswarn")!= "" && getcvarint("campsecswarn") > 20)
        
    level.campsecswarn getcvarint("campsecswarn");
        
        
    level.campsecspunish 9;
        if (
    getcvar("campsecspunish")!= "" && getcvarint("campsecspunish") >= level.campsecswarn)
        
    level.campsecspunish getcvarint("campsecspunish"); 
    but i make this like it, only:

    PHP Code:
        /* ... */

        //ALL "CAMP_SECS_*" vars must be multiples of "waitTime" (4 / 0.1 & 6 / 0.1 == true => good)
        
    CAMP_RADIUS getcvarint("campradius"); 
        
    CAMP_SECS_WARN getcvarint("camsecswarn");
        
    CAMP_SECS_PUNISH getcvarint("campsecspunish");

        
    /* ... */ 
    and init cvars from .cfg. mb make check on radius > 100 && campsecswarn > 0 && campsecswarn >= campsecspunish
    Last edited by maxdamage99; 23rd June 2021 at 08:22.
    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

  4. The Following 2 Users Say Thank You to maxdamage99 For This Useful Post:

    girdap (23rd June 2021),kung foo man (24th June 2021)

  5. #13
    Private
    Join Date
    Apr 2021
    Posts
    16
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Thank you so much. I completed everything. Finally..
    Where and how do I add this script so that flag bearers are not affected by the camp.


    PHP Code:
    attachFlag()
    {
        if(
    isdefined(self.flagAttached))
            return;

        if(
    self.pers["team"] == "allies")
            
    flagModel "xmodel/prop_flag_" game["axis"] + "_carry";
        else
            
    flagModel "xmodel/prop_flag_" game["allies"] + "_carry";
        
        
    self attach(flagModel"J_Spine4"true);
        
    self.flagAttached true;
        
        
    self thread createHudIcon();


  6. The Following User Says Thank You to girdap For This Useful Post:

    kung foo man (24th June 2021)

  7. #14
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    PHP Code:
    self.flagAttacher 
    this flag saw player has flag or no, add it in checkLoop()
    PHP Code:
        /* ... */
        
    while (1)
        {
            if (
    isAlive(self) && !self.flagAttached && (team == "allies" || team == "axis"))
            {

        
    /* ... */ 
    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

  8. The Following 2 Users Say Thank You to maxdamage99 For This Useful Post:

    girdap (25th June 2021),kung foo man (24th June 2021)

  9. #15
    Private
    Join Date
    Apr 2021
    Posts
    16
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by maxdamage99 View Post
    PHP Code:
    self.flagAttacher 
    this flag saw player has flag or no, add it in checkLoop()
    PHP Code:
        /* ... */
        
    while (1)
        {
            if (
    isAlive(self) && !self.flagAttached && (team == "allies" || team == "axis"))
            {

        
    /* ... */ 
    Thanks. i am getting error :



  10. The Following User Says Thank You to girdap For This Useful Post:

    kung foo man (24th June 2021)

  11. #16
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Instead of while (1) you can check while (isDefined(self)) or use endon at top of method
    timescale 0.01

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

    girdap (24th June 2021)

  13. #17
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    my code is resistant to this if you have properly organized code (default, standard from .iwd) and use "thread"

    try set self.flagAttached = false by default

    p.s: and try fix some by self, if you write all time when has error - you not learning
    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

  14. The Following User Says Thank You to maxdamage99 For This Useful Post:

    girdap (24th June 2021)

  15. #18
    Private
    Join Date
    Apr 2021
    Posts
    16
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by kung foo man View Post
    Instead of while (1) you can check while (isDefined(self)) or use endon at top of method
    After doing this:

    PHP Code:
            if (isAlive(self) && !self.flagAttached && self.pers["team"] == "allies" || self.pers["team"] == "axis"
    should i do like this?


    my code is resistant to this if you have properly organized code (default, standard from .iwd) and use "thread"

    try set self.flagAttached = false by default

    p.s: and try fix some by self, if you write all time when has error - you not learning

    use .iwd, this is how i do it.



    I have no clue how this is done.

    I'm trying to solve the errors myself, I'm testing. If I can't solve it, I write it here, not every mistake.

    for example
    PHP Code:
    (team == "allies" || team == "axis")) 
    fixed the error like this
    PHP Code:
    self.pers["team"] == "allies" || self.pers["team"] == "axis"
    ////

    this is the last edit. I couldn't fix the flag bearer.

    PHP Code:
    self.previousPosition self.origin;
        
    self.campTik 0;
        while (
    1)
        {
            if (
    isAlive(self) && !self.flagAttached && self.pers["team"] == "allies" || self.pers["team"] == "axis")
            {
                if (
    distance(self.previousPositionself.origin) > level.campradius)
                {
                    
    self.previousPosition self.origin;
                    
    self.campTik 0;
                }
                else
                    
    self.campTik++;
            
                
    campingTime = (self.campTik waitTime);
                if (
    campingTime == level.campsecswarn)
                    
    self iprintlnBold("stop camp or be kill!");
            
                if (
    campingTime == level.campsecspunish)
                {
                    
    self.campTik 0;
                    
    self iprintlnBold("Camper!");
                    
    self suicide();
                }
            }
            
            
    wait waitTime;
        }

    this is the last one.

  16. #19
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    PHP Code:
    self.previousPosition self.origin;
        
    self.campTik 0;
        while (
    1)
        {
            if (
    isAlive(self) && (!isDefined(self.flagAttached) || !self.flagAttached) && self.pers["team"] == "allies" || self.pers["team"] == "axis")
            {
                if (
    distance(self.previousPositionself.origin) > level.campradius)
                {
                    
    self.previousPosition self.origin;
                    
    self.campTik 0;
                }
                else
                    
    self.campTik++;
            
                
    campingTime = (self.campTik waitTime);
                if (
    campingTime == level.campsecswarn)
                    
    self iprintlnBold("stop camp or be kill!");
            
                if (
    campingTime == level.campsecspunish)
                {
                    
    self.campTik 0;
                    
    self iprintlnBold("Camper!");
                    
    self suicide();
                }
            }
            
            
    wait waitTime;
        }

    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  17. The Following User Says Thank You to IzNoGoD For This Useful Post:

    girdap (24th June 2021)

  18. #20
    Private
    Join Date
    Apr 2021
    Posts
    16
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Thanksss!! script finished. works flawlessly.

    thank so much IzNoGoD and maxdamage99

    they were very helpful, thank you.

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
  •