Results 1 to 8 of 8
  1. #1
    1997blackops1997's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Denmark
    Posts
    25
    Reputation
    10
    Thanks
    3
    My Mood
    Happy

    Whats wrong with this?

    Hey
    Whats wrong with this code:
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    weaponSelect()
    {
      self endon("disconnect");
      self endon("death");
      self endon ("end_thread");
    	
      self iPrintlnBold("Press ^3[{+actionslot 1}] for Intervention, ^3[{+actionslot 3}] for Barrett!");
      self notifyOnPlayerCommand("N", "+actionslot 1");
      self notifyOnPlayerCommand("3", "+actionslot 3");
      
      while (1)
      {
        if(self.buttonPressed[ "+actionslot 1" ] == 1)
        {
          self thread giveIntervention();
          self notify("end_thread");
        }
        else if(self.buttonPressed[ "+actionslot 3" ] == 1)
        {
          self thread giveBarrett();
          self notify("end_thread");
        }
      }
    }
    
    giveBarrett()
    {
      self takeAllWeapons();
      self giveWeapon("barrett_fmj_xmags_mp", 8, false);
      self switchToWeapon("barrett_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    }
    
    giveIntervention()
    {
      self takeAllWeapons();
      self giveWeapon("cheytac_fmj_xmags_mp", 8, false);
      self switchToWeapon("cheytac_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
        }
    }

  2. #2
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    Quote Originally Posted by 1997blackops1997 View Post
    Hey
    Whats wrong with this code:
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    weaponSelect()
    {
      self endon("disconnect");
      self endon("death");
      self endon ("end_thread");
    	
      self iPrintlnBold("Press ^3[{+actionslot 1}] for Intervention, ^3[{+actionslot 3}] for Barrett!");
      self notifyOnPlayerCommand("N", "+actionslot 1");
      self notifyOnPlayerCommand("3", "+actionslot 3");
      
      while (1)
      {
        if(self.buttonPressed[ "+actionslot 1" ] == 1)
        {
          self thread giveIntervention();
          self notify("end_thread");
        }
        else if(self.buttonPressed[ "+actionslot 3" ] == 1)
        {
          self thread giveBarrett();
          self notify("end_thread");
        }
      }
    }
    
    giveBarrett()
    {
      self takeAllWeapons();
      self giveWeapon("barrett_fmj_xmags_mp", 8, false);
      self switchToWeapon("barrett_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    }
    
    giveIntervention()
    {
      self takeAllWeapons();
      self giveWeapon("cheytac_fmj_xmags_mp", 8, false);
      self switchToWeapon("cheytac_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
        }
    }
    What is this?
    Code:
    if(self.buttonPressed[ "+actionslot 1" ] == 1)
    Try to use like:
    Code:
    self waittill("N");
    self waittill("3");
    Since this will do the notify:
    Code:
    self notifyOnPlayerCommand("N", "+actionslot 1"); //Will notify  N
    self notifyOnPlayerCommand("3", "+actionslot 3"); //Will notify  3

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  3. #3
    1997blackops1997's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Denmark
    Posts
    25
    Reputation
    10
    Thanks
    3
    My Mood
    Happy
    Quote Originally Posted by Jorndel View Post
    What is this?
    Code:
    if(self.buttonPressed[ "+actionslot 1" ] == 1)
    Try to use like:
    Code:
    self waittill("N");
    self waittill("3");
    Since this will do the notify:
    Code:
    self notifyOnPlayerCommand("N", "+actionslot 1"); //Will notify  N
    self notifyOnPlayerCommand("3", "+actionslot 3"); //Will notify  3
    For some reason it only works with the intervention..
    The code:
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    weaponSelect()
    {
      self endon("disconnect");
      self endon("death");
      self endon ("end_thread");
    	
      self iPrintlnBold("Press ^3[{+actionslot 1}] for Intervention, ^3[{+actionslot 3}] for Barrett!");
      self notifyOnPlayerCommand("N", "+actionslot 1");
      self notifyOnPlayerCommand("3", "+actionslot 3");
      
      while (1)
      {
        self waittill("N");
        {
          self thread giveIntervention();
          self notify("end_thread");
        }
        self waittill("3");
        {
          self thread giveBarrett();
          self notify("end_thread");
        }
      }
    }
    
    giveBarrett()
    {
      self takeAllWeapons();
      self giveWeapon("barrett_fmj_xmags_mp", 8, false);
      self switchToWeapon("barrett_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    }
    
    giveIntervention()
    {
      self takeAllWeapons();
      self giveWeapon("cheytac_fmj_xmags_mp", 8, false);
      self switchToWeapon("cheytac_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    }

  4. #4
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    Quote Originally Posted by 1997blackops1997 View Post
    For some reason it only works with the intervention..
    The code:
    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    weaponSelect()
    {
      self endon("disconnect");
      self endon("death");
      self endon ("end_thread");
    	
      self iPrintlnBold("Press ^3[{+actionslot 1}] for Intervention, ^3[{+actionslot 3}] for Barrett!");
      self notifyOnPlayerCommand("N", "+actionslot 1");
      self notifyOnPlayerCommand("3", "+actionslot 3");
      
      while (1)
      {
        self waittill("N");
        {
          self thread giveIntervention();
          self notify("end_thread");
        }
        self waittill("3");
        {
          self thread giveBarrett();
          self notify("end_thread");
        }
      }
    }
    
    giveBarrett()
    {
      self takeAllWeapons();
      self giveWeapon("barrett_fmj_xmags_mp", 8, false);
      self switchToWeapon("barrett_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    }
    
    giveIntervention()
    {
      self takeAllWeapons();
      self giveWeapon("cheytac_fmj_xmags_mp", 8, false);
      self switchToWeapon("cheytac_fmj_xmags_mp");
      self giveWeapon("deserteagle_fmj_mp");
      self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    }
    That is because the last wait is waiting for the first to be notified.

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  5. #5
    1997blackops1997's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Denmark
    Posts
    25
    Reputation
    10
    Thanks
    3
    My Mood
    Happy
    Quote Originally Posted by Jorndel View Post
    That is because the last wait is waiting for the first to be notified.
    What can I do to make them both work then?
    Im very new at coding so im not to good...

  6. #6
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    Quote Originally Posted by 1997blackops1997 View Post
    What can I do to make them both work then?
    Im very new at coding so im not to good...
    And I should?

    I can only think of doing it in 2 threads

    one thread for each action.
    (My skills are gone so I don't really remember the "Pro Way".)

    ---------- Post added at 12:54 PM ---------- Previous post was at 12:51 PM ----------

    weaponSelect()
    {
    self endon("disconnect");
    self endon("death");
    self endon ("end_thread");

    self iPrintlnBold("Press ^3[{+actionslot 1}] for Intervention, ^3[{+actionslot 3}] for Barrett!");
    }

    giveBarrett()
    {
    self endon("disconnect");
    self endon("death");

    self notifyOnPlayerCommand("N", "+actionslot 1");
    self waittill("N");

    self takeAllWeapons();
    self giveWeapon("barrett_fmj_xmags_mp", 8, false);
    self switchToWeapon("barrett_fmj_xmags_mp");
    self giveWeapon("deserteagle_fmj_mp");
    self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );

    self notify("end_thread");
    }

    giveIntervention()
    {
    self endon("disconnect");
    self endon("death");

    self notifyOnPlayerCommand("3", "+actionslot 3");
    self waittill("3");

    self takeAllWeapons();
    self giveWeapon("cheytac_fmj_xmags_mp", 8, false);
    self switchToWeapon("cheytac_fmj_xmags_mp");
    self giveWeapon("deserteagle_fmj_mp");
    self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );

    self notify("end_thread");
    }

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  7. #7
    1997blackops1997's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Denmark
    Posts
    25
    Reputation
    10
    Thanks
    3
    My Mood
    Happy
    Quote Originally Posted by Jorndel View Post
    And I should?

    I can only think of doing it in 2 threads

    one thread for each action.
    (My skills are gone so I don't really remember the "Pro Way".)

    ---------- Post added at 12:54 PM ---------- Previous post was at 12:51 PM ----------

    weaponSelect()
    {
    self endon("disconnect");
    self endon("death");
    self endon ("end_thread");

    self iPrintlnBold("Press ^3[{+actionslot 1}] for Intervention, ^3[{+actionslot 3}] for Barrett!");
    }

    giveBarrett()
    {
    self endon("disconnect");
    self endon("death");

    self notifyOnPlayerCommand("N", "+actionslot 1");
    self waittill("N");

    self takeAllWeapons();
    self giveWeapon("barrett_fmj_xmags_mp", 8, false);
    self switchToWeapon("barrett_fmj_xmags_mp");
    self giveWeapon("deserteagle_fmj_mp");
    self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );

    self notify("end_thread");
    }

    giveIntervention()
    {
    self endon("disconnect");
    self endon("death");

    self notifyOnPlayerCommand("3", "+actionslot 3");
    self waittill("3");

    self takeAllWeapons();
    self giveWeapon("cheytac_fmj_xmags_mp", 8, false);
    self switchToWeapon("cheytac_fmj_xmags_mp");
    self giveWeapon("deserteagle_fmj_mp");
    self maps\mp\perks\_perks::givePerk( "throwingknife_mp" );

    self notify("end_thread");
    }
    Yeah!
    Its working
    Thanks for the help

  8. #8
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    Quote Originally Posted by 1997blackops1997 View Post
    Yeah!
    Its working
    Thanks for the help
    np

    @lolbie
    @master131

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

Similar Threads

  1. whats wrong with this?
    By whitten in forum C++/C Programming
    Replies: 3
    Last Post: 08-21-2009, 07:41 PM
  2. Whats wrong with this?
    By superHackz in forum Visual Basic Programming
    Replies: 1
    Last Post: 05-31-2008, 11:35 AM
  3. Whats wrong with this?
    By superHackz in forum WarRock - International Hacks
    Replies: 1
    Last Post: 05-26-2008, 04:03 AM
  4. Whats wrong with this code ?
    By bohnenbong in forum WarRock - International Hacks
    Replies: 7
    Last Post: 10-26-2007, 06:57 AM
  5. whats wrong with this...
    By NetNavi in forum WarRock - International Hacks
    Replies: 6
    Last Post: 09-03-2007, 01:19 AM