View Single Post
  #1  
Old 04-29-2008, 08:59 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
hasscriptaccess()

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:
Graal Script 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".

Graal Script 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.
__________________
Do it with a DON!
Reply With Quote