Better way to do this?
#5

//EDIT2:
Quote:
Originally Posted by 2KY
Посмотреть сообщение
Sorry, I should have made it clear that I was working on "TEAM_BUM" and that they're going to have LS, LV, and SF coordinates aswell.
ah well, okey


------

you don't need a switch in your TEAM_BUM case, as from the code you supplyed, there's only one option. CITY_LS

so instead of:
PHP код:
 case TEAM_BUM:
        {
            switch(
curCity)
            {
                case 
CITY_LS:
                {
                    new
                        
randomsizeof(BumSpawnsLS) );
                    
SetPlayerPos(playeridBumSpawnsLS[r][0], BumSpawnsLS[r][1], BumSpawnsLS[r][2]);
                    
SetPlayerFacingAngle(playeridBumSpawnsLS[r][3]);
                }
            }
            
#if defined USE_ANTI_TEAMKILL
                
SetPlayerTeam(playeridTEAM_BUM);
            
#endif
        

you could just write

PHP код:
     case TEAM_BUM:
    {
        new 
randomsizeof(BumSpawnsLS) );
        
SetPlayerPos(playeridBumSpawnsLS[r][0], BumSpawnsLS[r][1], BumSpawnsLS[r][2]);
        
SetPlayerFacingAngle(playeridBumSpawnsLS[r][3]);
        
#if defined USE_ANTI_TEAMKILL
            
SetPlayerTeam(playeridTEAM_BUM);
        
#endif
    

//EDIT oh found something else,
before your main switch you could do
PHP код:
new r
and then just fill it in every case like
PHP код:
randomsizeof(BumSpawnsLS) );
//and so on... 
this doesen't really "boosts up" your code but...
well, in general, that code is good (my oppinion)
Reply


Messages In This Thread
Better way to do this? - by 2KY - 24.12.2013, 17:55
Re: Better way to do this? - by 2KY - 24.12.2013, 18:02
Re: Better way to do this? - by Patrick - 24.12.2013, 18:03
Re: Better way to do this? - by 2KY - 24.12.2013, 18:06
Re: Better way to do this? - by CutX - 24.12.2013, 18:12
Re: Better way to do this? - by 2KY - 24.12.2013, 18:14

Forum Jump:


Users browsing this thread: 1 Guest(s)