Adding 'PROMOTION' to /setrank
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Because you have a return right there. Return stops the function immediately.

Also use constant arrays to store the rank instead of repeating "set your rank to" a hundred times. If you ever wanted to change that message you'd have to change it in hundred different places which is far from ideal. Your current setup is also quite weird. Why not switch through factions first, then through ranks so you at least have them more or less together?

Something like this might work. It gets rid of the switch structure entirely. Not tested.

PHP код:
static const ranks[][][] = {
    
/* 0 */ "Cadet""Trooper""Lieutenant""Deputy Chief of Police""Chief of Police" },
    
/* 1 */ "Associate""Soldier",    "Capo",    "Underboss""Boss"    },    
    
/* 2 */ "Associate""Soldier""Capo""Underboss""Boss" },    
    
/* 3 */ "Raw Recruit""Street Soldier""Gang Fighter""Henchman""Gang Leader" },    
    
/* 4 */ "Raw Recruit""Street Soldier""Gang Fighter""Henchman""Gang Leader"    }    
};
format(stringsizeof(string), "%s set your rank to %s!"pNameranks[PlayerInfo[playerid][pFac] - 1][rank 1]); 
I'm going to look in to this actually. Thank you!

+rep
Reply


Messages In This Thread
Adding 'PROMOTION' to /setrank - by ross8839 - 05.06.2017, 18:01
Re: Adding 'PROMOTION' to /setrank - by Bwandon - 05.06.2017, 18:45
Re: Adding 'PROMOTION' to /setrank - by Vince - 05.06.2017, 18:47
Re: Adding 'PROMOTION' to /setrank - by ross8839 - 05.06.2017, 19:00

Forum Jump:


Users browsing this thread: 1 Guest(s)