 |
|
New Member
|

07-04-2018
, 23:17
Re: Feedback request
|
#3
|
Quote:
Originally Posted by kristi
Nope. In Pawn we do it like this:
PHP Code:
case 1, 2, 3:
{
// code
}
or
PHP Code:
case 1, 2, 3: return same_value_for_these;
|
Great, thanks!
Quote:
Originally Posted by maqi
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 
|
Didn't even think of using array, that probably might be optimized as little bit faster and best part of all, less code.
Thanks to both of you
__________________
|
|
|
|