12.12.2009, 22:23
I've got a command that makes a file with the title-number you choosed.
Command:
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.
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;
}
Can somebody point out the error in this code ? Thank you.
