Raised This Month: $ Target: $400
 0% 

Question about #define


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-31-2017 , 11:15   Question about #define
Reply With Quote #1

Is there a way to predefine this?
PHP Code:
#define GET_MODEL_DIR_FROM_FILE(%1)    "models/plugin/%1.mdl" 
I want to change all
PHP Code:
formatex(..., ..., "models/plugin/%s.mdl"szModel
to just GET_MODEL_DIR_FROM_FILE(szModel).

Where szModel is a string without .mdl.

Last edited by grs4; 01-31-2017 at 11:40.
grs4 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-31-2017 , 17:39   Re: Question about #define
Reply With Quote #2

You can do this
PHP Code:
#define GET_MODEL_DIR_FROM_FILE(%1,%2)    formatex(%1,charsmax(%1),"models/plugin/%s.mdl",%2) 

new szDest32 ];
GET_MODEL_DIR_FROM_FILEszDest "thefile" ); 
Output
Code:
models/plugin/thefile.mdl
__________________

Last edited by Bugsy; 01-31-2017 at 17:40.
Bugsy is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 01-31-2017 , 19:13   Re: Question about #define
Reply With Quote #3

PHP Code:
#define GET_MODEL_DIR_FROM_FILE(%1) fmt("models/plugin/%s.mdl", (%1)) 
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 02-01-2017 , 08:40   Re: Question about #define
Reply With Quote #4

Thank you

Last edited by grs4; 02-01-2017 at 08:40.
grs4 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 20:47.


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