Raised This Month: $32 Target: $400
 8% 

#define directive parameter inside a string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-07-2021 , 02:50   #define directive parameter inside a string
Reply With Quote #1

#define SQL_STATEMENT_NOT_EXPIRED(%1) ("(DurationMinutes != 0 AND TimestampGiven + (60 * DurationMinutes) < %1)")

I have this define. It doesn't work at all. How can I make it work? I spammed questions for google in other programming languages as well with no success. The parameter doesn't want to work inside a string.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 05-07-2021 , 05:51   Re: #define directive parameter inside a string
Reply With Quote #2

Code:
#define SQL_STATEMENT_NOT_EXPIRED(%1) "DurationMinutes != 0 AND TimestampGiven + 60 * DurationMinutes < "...%1

public void OnPluginStart()
{
	PrintToServer(SQL_STATEMENT_NOT_EXPIRED("10"));
}
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-10-2021 , 13:09   Re: #define directive parameter inside a string
Reply With Quote #3

Quote:
Originally Posted by Dragokas View Post
Code:
#define SQL_STATEMENT_NOT_EXPIRED(%1) "DurationMinutes != 0 AND TimestampGiven + 60 * DurationMinutes < "...%1

public void OnPluginStart()
{
	PrintToServer(SQL_STATEMENT_NOT_EXPIRED("10"));
}
It appears it won't work with GetTime.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 05-10-2021 , 17:45   Re: #define directive parameter inside a string
Reply With Quote #4

Surely, it requires you casting or format specifier.

Hack:

PHP Code:
#define SQL_STATEMENT_NOT_EXPIRED(%1) FormatInline("DurationMinutes != 0 AND TimestampGiven + 60 * DurationMinutes < %i", %1)

char[] FormatInline(const char[] formatany ...)
{
    static 
char buffer[1024];
    
VFormat(buffersizeof(buffer), format2);
    return 
buffer;
}

public 
void OnPluginStart()
{
    
PrintToServer(SQL_STATEMENT_NOT_EXPIRED(GetTime()));

__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Reply


Thread Tools
Display Modes

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 12:46.


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