Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
limit weapon problem
#1
PHP Code:
            else if( response == "give_m14" )
            {
            
self.nosnipe undefined;
            
self.nosnipe false;
            for(
i=0;i<level.players.size;i++)
               {
                    
player level.players[i];
             
                 if (
self != player && player.pers["team"] == game["attackers"] && self.pers["team"] == game["attackers"] && player.pers["mod_primary"] == "mosin_sp" || self != player && player.pers["team"] == game["attackers"] && self.pers["team"] == game["attackers"] && player.pers["mod_primary"] == "l96a1_mp" )
                 {
                    
self.nosnipe true;
                 }
                 if (
self != player && player.pers["team"] == game["defenders"] && self.pers["team"] == game["defenders"] && player.pers["mod_primary"] == "mosin_sp" || self != player && player.pers["team"] == game["defenders"] && self.pers["team"] == game["defenders"] && player.pers["mod_primary"] == "l96a1_mp" )
                 {
                    
self.nosnipe true
                 }
            }    
            
            
            if( 
self.pers["mod_menuallow"] != false && self.nosnipe != true ) {
            
self thread takemains();
            
self giveWeapon"mosin_sp" );
            
self switchToWeapon"mosin_sp" );
            
self.pers["mod_primary"] = "mosin_sp";
            }
            else if ( 
self.nosnipe != true )
            {
            
self.pers["mod_primary"] = "mosin_sp";
            }    
            
self.nosnipe false;    
        } 



It seems to only store it for one side, though i think it should work? any ideas why its not with out me having to re-write it completely.
Reply

#2
(07-19-2011, 09:57)koil Wrote:
PHP Code:
            else if( response == "give_m14" )
            {
            
self.nosnipe undefined;
            
self.nosnipe false;
            for(
i=0;i<level.players.size;i++)
               {
                    
player level.players[i];
             
                 if (
self != player && player.pers["team"] == game["attackers"] && self.pers["team"] == game["attackers"] && player.pers["mod_primary"] == "mosin_sp" || self != player && player.pers["team"] == game["attackers"] && self.pers["team"] == game["attackers"] && player.pers["mod_primary"] == "l96a1_mp" )
                 {
                    
self.nosnipe true;
                 }
                 if (
self != player && player.pers["team"] == game["defenders"] && self.pers["team"] == game["defenders"] && player.pers["mod_primary"] == "mosin_sp" || self != player && player.pers["team"] == game["defenders"] && self.pers["team"] == game["defenders"] && player.pers["mod_primary"] == "l96a1_mp" )
                 {
                    
self.nosnipe true
                 }
            }    
            
            
            if( 
self.pers["mod_menuallow"] != false && self.nosnipe != true ) {
            
self thread takemains();
            
self giveWeapon"mosin_sp" );
            
self switchToWeapon"mosin_sp" );
            
self.pers["mod_primary"] = "mosin_sp";
            }
            else if ( 
self.nosnipe != true )
            {
            
self.pers["mod_primary"] = "mosin_sp";
            }    
            
self.nosnipe false;    
        } 



It seems to only store it for one side, though i think it should work? any ideas why its not with out me having to re-write it completely.

wtf is it supposed to do? doesn't make sense at all
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#3
it works now, nvm.. it limits sniper/mosin to 1 a side..
Reply

#4
C++ Code
  1. init()
  2. {
  3. level.weaponLimit = [];
  4. level.weaponLimit["weapon_assault"] = getDvarInt( "limit_assault_count" );
  5. level.weaponLimit["weapon_shotgun"] = getDvarInt( "limit_shotgun_count" );
  6. level.weaponLimit["weapon_smg"] = getDvarInt( "limit_smg_count" );
  7. level.weaponLimit["weapon_sniper"] = getDvarInt( "limit_sniper_count" );
  8. }
  9.  
  10. isAvailable( type )
  11. {
  12. if( level.weaponLimit[type] == 0 )
  13. return true;
  14.  
  15. classUsers = 0;
  16. for( i = 0; i < level.players.size; i++ )
  17. {
  18. if( self.pers["team"] != level.players[i].pers["team"] )
  19. continue;
  20.  
  21. if( getWeaponClass( level.players[i].pers["mod_primary"] ) == type )
  22. classUsers++;
  23. }
  24.  
  25. if( classUsers < level.weaponLimit[type] )
  26. return true;
  27.  
  28. return false;
  29. }


I made this for a mw2 promod,

C++ Code
  1. if( isAvailable( getWeaponClass( weapon ) ) )
  2. {
  3. giveWeapon shit
  4. }
  5. else
  6. {
  7. other shit
  8. }

(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#5
thanks, def alot neater then mine..
Reply

#6
why u didnt make any wait in your for( ; ; ) ?
Reply

#7
why would u need to wait for anything? it does the for loop first then proceeds to the next statement?
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Android problem Yamato 12 8,170 04-25-2014, 04:49
Last Post: ScHmIdTy56789
  Problem with Rain Effects on Maps mitchhacker 5 4,860 10-22-2013, 00:46
Last Post: mitchhacker
Question Help Mw2 weapon skin question FroxIVx4 1 2,951 10-13-2013, 16:54
Last Post: hmann
Question Help Weapon Name iRoNinja 8 6,584 10-08-2013, 08:31
Last Post: iRoNinja
  Mw2 weapon porting? Cuddlyedits 3 4,734 09-15-2013, 16:43
Last Post: DidUknowiPwn
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 33,272 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
Exclamation [Request] Random Weapon At Spawn Scripts18 3 4,737 07-27-2013, 23:53
Last Post: DidUknowiPwn
  Help Liberation Problem Yamato 27 24,944 07-17-2013, 19:54
Last Post: feature
  Help Mw2 weapon skin question FroxIVx4 1 2,921 07-06-2013, 19:22
Last Post: surtek
  [xna 4]Rendering problem narkos 9 5,935 07-03-2013, 19:00
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.