How to make pawn to ignore % character in string? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make pawn to ignore % character in string? (
/showthread.php?tid=110341)
How to make pawn to ignore % character in string? -
Dujma - 25.11.2009
I have a little problem. I'm trying to insert mysql function
DATE_FORMAT but it doesn't work because pawno won't ignore the % character.
This is the string:
pawn Code:
format(query, sizeof(query), "INSERT INTO `"TABLE_BANS"` (`player`, `admin`, `reason`, `expireDate`, `expireTime`) VALUES ('%s', '%s', '%s', DATE_FORMAT(DATE_ADD(curdate(), INTERVAL %d DAY), '%d/%m/%Y'), curtime())",
player,
admin,
reason,
days);
But this
part DATE_FORMAT(DATE_ADD(curdate(), INTERVAL %d DAY), '
%d/%m/%Y') gets messed up and I have MySQL results like
I tryed to add escape charater \ but it doesn't help... Does anyone has any idea how to solve this?
Re: How to make pawn to ignore % character in string? -
Mikep. - 25.11.2009
%d = Number.
Just put %d/%d/%d
What does curtime return? A string? If so use %s.
Read the wiki in future.
Re: How to make pawn to ignore % character in string? -
Peter_Corneile - 25.11.2009
https://sampwiki.blast.hk/wiki/Format
Re: How to make pawn to ignore % character in string? -
yom - 25.11.2009
Try with another % so it looks like '%%d' etc.
Re: How to make pawn to ignore % character in string? -
Dujma - 25.11.2009
Quote:
Originally Posted by ►Peter Corneile◄
|
lol tnx
Quote:
Originally Posted by 0rb
Try with another % so it looks like '%%d' etc.
|
Yea that was the solution.
Tnx guys.