AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question about #define (https://forums.alliedmods.net/showthread.php?t=293414)

grs4 01-31-2017 11:15

Question about #define
 
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.

Bugsy 01-31-2017 17:39

Re: Question about #define
 
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

PRoSToTeM@ 01-31-2017 19:13

Re: Question about #define
 
PHP Code:

#define GET_MODEL_DIR_FROM_FILE(%1) fmt("models/plugin/%s.mdl", (%1)) 


grs4 02-01-2017 08:40

Re: Question about #define
 
Thank you :)


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

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