Raised This Month: $51 Target: $400
 12% 

Why 192?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Themaze
Junior Member
Join Date: Mar 2017
Old 12-21-2017 , 03:08   Why 192?
Reply With Quote #1

I know it's a noob question but i'm curious why he used menu[192] rather than any other number?

//The clcmd function will just give us the player id
public showWeaponMenu(id)
{
new menu[192]
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2

format(menu, 191, "Which Weapon?^n^n1. AK47^n2. M4A1^n3. AWP")
show_menu(id, keys, menu)
return PLUGIN_HANDLED
}

Last edited by Themaze; 12-21-2017 at 03:08.
Themaze is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-21-2017 , 04:55   Re: Why 192?
Reply With Quote #2

You need to put a dimension big enough to hold all the data. Here 192 is just too much, since the text is short. Just a waste of memory.
__________________
HamletEagle is offline
Themaze
Junior Member
Join Date: Mar 2017
Old 12-22-2017 , 02:51   Re: Why 192?
Reply With Quote #3

Understood thank you
Themaze is offline
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 12-22-2017 , 14:45   Re: Why 192?
Reply With Quote #4

why do people hate the charsmax macro?
felhasznalo is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-22-2017 , 15:05   Re: Why 192?
Reply With Quote #5

Quote:
Originally Posted by felhasznalo View Post
why do people hate the charsmax macro?
Because they don't understand how important it is.
__________________
HamletEagle is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-22-2017 , 16:19   Re: Why 192?
Reply With Quote #6

I wouldn't say that it's necessarily "super important" (because it's not invalid code to not use it) but it's definitely much smarter to use than any other method. It's also, like it should be, a requirement for released plugins.
__________________
fysiks is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-23-2017 , 02:53   Re: Why 192?
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
I wouldn't say that it's necessarily "super important" (because it's not invalid code to not use it) but it's definitely much smarter to use than any other method. It's also, like it should be, a requirement for released plugins.
Of course, what I meant by "important" is that it's a pain to change the size everywhere in a big project. You have to do it once then you realize how bad hardcoding is.
__________________

Last edited by HamletEagle; 12-23-2017 at 02:55.
HamletEagle is offline
Reply



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 04:09.


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