File Already Exists-problem.
#3

Quote:
Originally Posted by Rac3r
You need to format the string, where the file is located.

Код:
if(!fexist(file))
Example only:
Код:
new file[256];
new name[24];
GetPlayerName(playerid, name, 24);
format(string, 256, "my_gamemode/accounts/%s.ini", name);
if(!fexists(string))
{
 //file doesn't exist blah blah
}
else
{
  login
}
You sure about that? Here's my /register command, I never specify the path. It saves in Scriptfiles per default. And the "This already exists" works perfect.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], idx, file[128], tmp[256], tmp2[256];
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/register", true) == 0)
    {
      new name[MAX_PLAYER_NAME];
      tmp = strtok(cmdtext, idx);
      GetPlayerName(playerid, name, sizeof(name));
      if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "Usage: /register (password)");
      format(file,sizeof(file),"%s.ini",name);
      if(!fexist(file))
            {

dini_Create(file);
And more here.
}
            else
            {
              SendClientMessage(playerid, COLOR_GREY, "ERROR: Account already exists. Please login.");
                PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            }
Reply


Messages In This Thread
File Already Exists-problem. - by IcyBlight - 11.05.2010, 18:28
Re: File Already Exists-problem. - by Rac3r - 11.05.2010, 18:33
Re: File Already Exists-problem. - by IcyBlight - 11.05.2010, 18:42
Re: File Already Exists-problem. - by Jefff - 11.05.2010, 18:47
Re: File Already Exists-problem. - by IcyBlight - 11.05.2010, 18:53

Forum Jump:


Users browsing this thread: 1 Guest(s)