SA-MP Forums Archive
format function in if statement? - 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)
+--- Thread: format function in if statement? (/showthread.php?tid=424468)



format function in if statement? - reckst4r - 22.03.2013

Is it possible to put a format function inside an if statement? I'm trying to do this:
pawn Код:
if(format(query2, sizeof(query2), "SELECT id FROM `gates` WHERE id = '%i'", i));
but the compiler says it's an empty statement


Re: format function in if statement? - reckst4r - 22.03.2013

Oh, right.. I didn't notice I placed the ";". Anyway, I'm going to use brackets to check if the ID already exists.


Re: format function in if statement? - Apenmeeuw - 22.03.2013

ye, you could use strfind or strcmp for this:

https://sampwiki.blast.hk/wiki/Strcmp

https://sampwiki.blast.hk/wiki/Strfind


Re: format function in if statement? - Apenmeeuw - 22.03.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Neither of those functions will help either! They are quite clearly formatting an SQL query, for which you need either the SQLite or MySQL functions to run.
sorry, my bad, didnt notice the sql part