Raised This Month: $ Target: $400
 0% 

[HELP] Switch between const size numbers


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-26-2014 , 11:15   Re: [HELP] Switch between const size numbers
Reply With Quote #6

Code:
read_argv(4, szCmd, sizeof szCmd);
There is only 1 argument with the say command.
The SayText message on the other hand contains 4 arguments, and the text is within the 4th argument if it's a say command that triggered the message.

sizeof is not suitable for strings alone. use sizeof X -1 or charsmax().

Code:
new iNum;       healthPotion[iNum]
Makes no sense at all.

iNum will cause index out of bounds unless limited.

You're far better of hardcoding it. This only increases the CPU usage and decreases readability, unless I'm misunderstanding something.
__________________

Last edited by Black Rose; 05-26-2014 at 11:19.
Black Rose 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:43.


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