Raised This Month: $ Target: $400
 0% 

Feedback request


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hts
New Member
Join Date: Jul 2018
Old 07-04-2018 , 23:17   Re: Feedback request
Reply With Quote #3

Quote:
Originally Posted by kristi View Post
Nope. In Pawn we do it like this:
PHP Code:
case 123:
{
    
// code

or
PHP Code:
case 123: return same_value_for_these
Great, thanks!

Quote:
Originally Posted by maqi View Post
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
__________________
hts is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode