FileManager plugin
#1

I have got a problem. I have added a simple script which checks is "Users" folder exists, if not - it creates it. But if I start gamemode, it crashes (message about report it to microsoft ). I'm using FileManager plugin by JaTochNietDam (or Dan ) Here's a code:

Код:
	new Users[128];
	if(file_exists(Users))
	{
	    print("User folders exists! Loading");
	}
	else
	{
		file_create(Users);
	}
Could anyone solve this from crash and repair it, please?
Reply
#2

You're not using it correctly. You're trying to create a file with an empty string, there's no need for an array at all in this case, just directly write the string into the functions:

pawn Код:
if(file_exists("Users"))
{
    print("User folders exists! Loading");
}
else
{
    file_create("Users");
}
Although you said you were trying to create a folder? Then you need to use the dir_ functions, not the file_ functions! As they are for files and not folders.

It may also be worth noting that for files you do not have to check if they exist. It doesn't crash if it fails to perform an action on a file because it doesn't exist or anything else.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)