29.03.2010, 16:18
i got a problem with my saving when i create a note that contains text it only saves like 20 characters or 30 any fix how to make it save like 50?
On the file saving, is there any thing to do so it saves the whole text and not like 20 characters, its not enough.
pawn Код:
// Her it is in the playerinfo enum
Playerinfo =
pNote1[128],
///createnote The /create note ting
if(strcmp(cmd, "/createnote", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(length > 60)
{
SendClientMessage(playerid, COLOR_GREY, "Error: Note is too long");
return 1;
}
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createnote [text]");
return 1;
}
if(PlayerInfo[playerid][pNote1s] == 0)
{
strmid(PlayerInfo[playerid][pNote1], result, 0, strlen(result), 255);
PlayerInfo[playerid][pNote1s] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Note successfully created");
return 1;
}
else if(PlayerInfo[playerid][pNote2s] == 0)
{
strmid(PlayerInfo[playerid][pNote2], result, 0, strlen(result), 255);
PlayerInfo[playerid][pNote2s] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Note successfully created");
return 1;
}
else if(PlayerInfo[playerid][pNote3s] == 0)
{
strmid(PlayerInfo[playerid][pNote3], result, 0, strlen(result), 255);
PlayerInfo[playerid][pNote3s] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Note successfully created");
return 1;
}
else if(PlayerInfo[playerid][pNote4s] == 0)
{
strmid(PlayerInfo[playerid][pNote4], result, 0, strlen(result), 255);
PlayerInfo[playerid][pNote4s] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Note successfully created");
return 1;
}
else if(PlayerInfo[playerid][pNote5s] == 0)
{
strmid(PlayerInfo[playerid][pNote5], result, 0, strlen(result), 255);
PlayerInfo[playerid][pNote5s] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Note successfully created");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Error: You have no free pages left in your notebook");
return 1;
}
}
return 1;
}
//The saving ( The problem might be here )
format(var, 32, "Note1=%s\n",PlayerInfo[playerid][pNote1]);fwrite(hFile, var);