Raised This Month: $ Target: $400
 0% 

STR DEFINE to INTEGER


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-09-2010 , 19:56   Re: STR DEFINE to INTEGER
Reply With Quote #1

Quote:
Originally Posted by mysticssjgoku4 View Post
The function I use requires a string for the entire system of plugins I am coding, and I don't feel like editing through 1000's of lines of code changing it over, and unnecessarily converting over each number to a string before use just because I need just this one define as an integer.
PHP Code:
#define g_Scans_Needed          30

new A_SG_Marines_3_val]
new 
g_Scans[33][ g_Scans_Needed ];

public 
plugin_init() 
     
num_to_strg_Scans_Needed A_SG_Marines_3_val ); 
__________________

Last edited by Bugsy; 06-09-2010 at 20:01.
Bugsy is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 06-09-2010 , 19:59   Re: STR DEFINE to INTEGER
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
PHP Code:
#define THENUMBER     30

new TheVar33 ][ THENUMBER ];
new 
A_SG_Marines_3_val];  //Use this for all other functions that need the string

//plugin_init 
    
num_to_strTHENUMBER A_SG_Marines_3_val ); 
Hmm. Thanks, ill mess around and figure something out I suppose. I am trying to keep the system uniform in style.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-10-2010 , 01:25   Re: STR DEFINE to INTEGER
Reply With Quote #3

Problem is that you can only use str_to_num(A_SG_Marines_3_val) in a function, and other problem is that you can only set an array size with a const.
That's why Bugsy took the problem in the other way, so you build the string from the const integer instead of retrieve the integer from the string.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 05:26.


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