Raised This Month: $ Target: $400
 0% 

Array and variables


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
akysiev
Junior Member
Join Date: Mar 2006
Location: Earth
Old 03-24-2006 , 07:10  
Reply With Quote #1

Oh, I see. But anyways when a player presses the associated key in the menu, it passes an integer key, not a string. It would probably be best if you gave us more code or the entire script.
akysiev is offline
L0neW0lf
Member
Join Date: Mar 2006
Location: Denmark
Old 03-24-2006 , 07:31  
Reply With Quote #2

The whole script is huge, and the handle of the menu is handled in those 4 cases......

Code:
//The difinition of the menu new g_HighBanMenuValues[4] = {60, 4320, 10080, 0} // The numbers are in minutes.. 0 = PERMANENT BAN //The Handle of the user input, setting menuSttings[id] to the value predefined in HighBanMenuValues. if (get_user_flags(id)&HIGHER_BAN_TIME_ADMIN)   {       switch(g_menuOption[id])       {           case 0: g_menuSettings[id] = g_HighBanMenuValues[0] //1Hour         case 1: g_menuSettings[id] = g_HighBanMenuValues[1] //3Days         case 2: g_menuSettings[id] = g_HighBanMenuValues[2] //7Days         case 3: g_menuSettings[id] = g_HighBanMenuValues[3] //Permanent     }   } //What i want is to have the menu look like this: new g_HighBanMenuValues[4] = {1Hour, 3Days, 7Days, Permanent}

but my problem is that the server dont know 1Hour so i need to convert the string to a number, so the server understands it

Hope this make more sense
L0neW0lf is offline
Send a message via ICQ to L0neW0lf Send a message via MSN to L0neW0lf Send a message via Skype™ to L0neW0lf
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-24-2006 , 08:10  
Reply With Quote #3

Quote:
Originally Posted by Hawk552
This is the most dynamic way I can think of.

Also, this is not a string, so it doesn't need a null terminator. It is simply an array.

Code:
#define Second 1 #define Minute 60*Second #define Hour 60*Minute #define Day 24*Hour #define Week 7*Day #define Month 30*Day #define Permanent 0 new g_HighBanMenuValues[4] = {Hour, 3*Day, Week, Permanent}

On a side note, you can do

Code:
new g_HighBanMenuValues[] = {Hour, 3*Day, Week, Permanent}

And it should work.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 03-24-2006 , 08:18  
Reply With Quote #4

Hawk, that's not what he's asking.

He wants the menu to show the text but return the integer as both him and I already stated. Your example makes the code easier to read but that's not what he's after.

Quote:
Originally Posted by akysiev
Oh, I see. But anyways when a player presses the associated key in the menu, it passes an integer key, not a string. It would probably be best if you gave us more code or the entire script.
I believe he's changing the AMXBans plugin.
Brad is offline
L0neW0lf
Member
Join Date: Mar 2006
Location: Denmark
Old 03-24-2006 , 09:27  
Reply With Quote #5

Yah thats the one i am trying to edit so the users can see the text instead off numbers......
L0neW0lf is offline
Send a message via ICQ to L0neW0lf Send a message via MSN to L0neW0lf Send a message via Skype™ to L0neW0lf
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 16:38.


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