hasscriptaccess(filepath, readonly) - returns true if the file at the given filepath can be accessed with the various load/save functions such as loadlines(). readonly is a bool that is true if you only want to check if the file can be read regardless of if you can write to it.
Example:
PHP Code:
//#CLIENTSIDE
function onCreated() {
if (hasscriptaccess("Graal.exe", 1))
echo("I have script access to Graal.exe");
else
echo("I do not have script access to Graal.exe");
}
Would echo "I do not have script access to Graal.exe".
PHP Code:
//#CLIENTSIDE
function onCreated() {
if (hasscriptaccess("scriptfiles/" @ servername @ "/newfile.nw", 1))
echo("I have script access to newfile.nw");
else
echo("I do not have script access to newfile.nw");
}
Would echo "I have script access to newfile.nw".
Of course on the clientside the second parameter would only check if the file was read-only or not.
The function should also be supported serverside which would basically return the (npcserver)'s hasfolderright() to the file with respect to r and rw depending on the second parameter.
What do you think, could you implement this function Stefan? Really would like it for my global client/server file browser I'm making (which is required for my scripted level editor) as well as a few other things.