SA-MP Forums Archive
help me with checking if file exists - 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: help me with checking if file exists (/showthread.php?tid=422313)



help me with checking if file exists - akki - 13.03.2013

i am using filemanager
https://sampforum.blast.hk/showthread.php?tid=92246 (this one)
i want to check if a file exists or not using native file_exists
the problem is that i don't know how to do this. i mean that if it returns a value how can i save it or how can i use this in if conditions.
please help
and also one more help
when i type native its color does not change to blue what are the problems.


Re: help me with checking if file exists - cessil - 13.03.2013

if it returns false then the file does not exist, if it returns true then it does.
I got that information from reading the thread you linked, as I'm sure you could of done the same


Re: help me with checking if file exists - akki - 13.03.2013

Quote:
Originally Posted by cessil
Посмотреть сообщение
if it returns false then the file does not exist, if it returns true then it does.
I got that information from reading the thread you linked, as I'm sure you could of done the same
that is fine
but how to use it?


Re: help me with checking if file exists - Vince - 13.03.2013

If true do stuff, if false do other stuff. Really, this is the core of programming.


Re: help me with checking if file exists - Sinner - 13.03.2013

pawn Код:
if(file_exists("example.txt")) {
    // File exists
} else {
    // File does not exist
}
Why are you working with files if you don't understand the absolute backbone of programming?