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

Constants & Includes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-10-2017 , 12:53   Constants & Includes
Reply With Quote #1

I am writing an include with stocks/defines/constants in order to not have to write them in every plugin, but i ran into some trouble, so could anyone please tell me

What is the proper way to integrate these constants from a plugin into an include ?

I know for the one dimensional constant i can use #define to not get warnings, but for the other two ?
PHP Code:

const constant1[][] = { "blabla""blabla""blabla" }
const 
constant2[] = { 12345}

const 
constant3 = (1<<CSW_KNIFE) | (1<<CSW_C4) | (1<<CSW_USP
__________________

Last edited by Depresie; 02-10-2017 at 12:58.
Depresie is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-10-2017 , 13:01   Re: Constants & Includes
Reply With Quote #2

What warnings?
klippy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-10-2017 , 13:24   Re: Constants & Includes
Reply With Quote #3

"Symbol is never used"
__________________
Depresie is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-10-2017 , 13:28   Re: Constants & Includes
Reply With Quote #4

Use
PHP Code:
stock const constant1[] = "Stuff"
klippy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-10-2017 , 13:32   Re: Constants & Includes
Reply With Quote #5

Thanks
__________________
Depresie is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 02-10-2017 , 16:49   Re: Constants & Includes
Reply With Quote #6

you could also make them as defines

PHP Code:
#define ZERO 0
#define ONE 1
#define SOME_CONST "some_const_text" 
etc..

Last edited by safetymoose; 02-10-2017 at 16:50.
safetymoose 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 03:35.


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