File problem...
#1

I've got a command that makes a file with the title-number you choosed.

Command:

pawn Код:
cmd(createnumber, playerid, params[])
{
  if(IsPlayerConnected(playerid))
  {
    new number;
    new string[128];
    new string2[32];
    if(sscanf(params, "d",number))
    {
       SendClientMessage(playerid, COLOR_HELP, "USAGE: /createnumber [number]");
       return 1;
    }
    if(number < 1000 || number > 9999999)
    {
       SendClientMessage(playerid, COLOR_ERROR, "INFO: Number can't begin with 0 and can't have less than 4 or more than 7 digits.");
       return 1;
    }
    format(string2, sizeof(string2), "Numbers/%s.ini", number);
    if(fexist(string2))
    {
       SendClientMessage(playerid, COLOR_ERROR, "INFO: The number you entered already exists. Please try another one.");
       return 1;
    }
    fopen(string2, io_write);
    format(string, sizeof(string), "INFO: You have successfully created number %d.", number);
    SendClientMessage(playerid, COLOR_INFO, string);
    PlayerPlaySound(playerid, 1052, 0.0,0.0,0.0);      
  }
  return 1;
}
Well, when i type in /createnumber 8000 it says that i successfully created that number, but when i go into the Numbers folder i see strange characters and not numbers that i typed in.

Can somebody point out the error in this code ? Thank you.
Reply


Messages In This Thread
File problem... - by Zeromanster - 12.12.2009, 22:23
Re: File problem... - by LarzI - 12.12.2009, 22:30
Re: File problem... - by Correlli - 12.12.2009, 22:31
Re: File problem... - by LarzI - 12.12.2009, 22:34
Re: File problem... - by Zeromanster - 12.12.2009, 22:38
Re: File problem... - by Correlli - 12.12.2009, 23:10
Re: File problem... - by Zeromanster - 12.12.2009, 23:16
Re: File problem... - by Zeromanster - 13.12.2009, 12:31
Re: File problem... - by Zeromanster - 13.12.2009, 15:52
Re: File problem... - by Correlli - 13.12.2009, 16:29

Forum Jump:


Users browsing this thread: 1 Guest(s)