AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Constants & Includes (https://forums.alliedmods.net/showthread.php?t=293784)

Depresie 02-10-2017 12:53

Constants & Includes
 
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


klippy 02-10-2017 13:01

Re: Constants & Includes
 
What warnings?

Depresie 02-10-2017 13:24

Re: Constants & Includes
 
"Symbol is never used"

klippy 02-10-2017 13:28

Re: Constants & Includes
 
Use
PHP Code:

stock const constant1[] = "Stuff"


Depresie 02-10-2017 13:32

Re: Constants & Includes
 
Thanks

safetymoose 02-10-2017 16:49

Re: Constants & Includes
 
you could also make them as defines

PHP Code:

#define ZERO 0
#define ONE 1
#define SOME_CONST "some_const_text" 

etc..


All times are GMT -4. The time now is 20:55.

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