08.11.2009, 13:36
Trying to make it save, but this crashes the server:
I made it with a command just for tests. I will make it automatic after i make it work.
Help please.
EDIT: The path is correct, the folder and file exist.
pawn Код:
if(!strcmp(cmdtext[1],"SaveInv",true,14))
{
new File:inventory = fopen("CRP_Scriptfiles/Inventories/inv.ini", io_write);
new string[MAX_ITEM_NAME+20];
new amount = strval(cmdtext[16]);
GetPlayerName(amount,string,sizeof(string));
for(new index;index<MAX_ITEMS;index++)
{
PlayerInventoryPlayerItemData(playerid,index,string,amount);
format(string,sizeof(string),"%s -- %d",string,amount);
fwrite(inventory, string);
}
fclose(inventory);
}
Help please.
EDIT: The path is correct, the folder and file exist.