Quote:
Originally Posted by hts
Code:
case 1:
case 2:
case 3:
return same_value_for_these;
|
You can't do this because in pawn you don't manually break the switch statement.
Anyhow, a few tips, if I may:
You don't want to use such a long switch with so many cases for something as simple as this. Simply create a constant array, something like this,
Code:
new const AWARD_MONEY[31] = { 0, 300, 500, 200, 100, 0, 200, 500 /* etc up to 31*/ } ;
Check
https://wiki.alliedmods.net/CS_Weapons_Information on how to index the array ( 0th element shouldn't be used in this case )
Then simply
Code:
new award = AWARD_MONEY[wpn_id];
You don't need that whole function at all
( Always check if wpn_id is valid [ 1 > 30 ] so you don't run into index out of bounds errors )
Also, you don't need the num_money variable at all in this case, once you define the cur_money, work with it ( You kinda do anyway )
And the most important tip, post this kind of questions in scripting help in the future
__________________