22.11.2009, 10:39
Hello,
I got a problem. I am trying to make Player Inventory by Joe (http://forum.sa-mp.com/index.php?topic=116917.0) save in a file, but i am too new to saving and stuff. I read the guide about that but it's too complicated for me. I just want a good example of that and i will learn.
I tried this:
I wanted to make it save when i enter the command (just for tests), but it crashes whole server.
Thanks.
I got a problem. I am trying to make Player Inventory by Joe (http://forum.sa-mp.com/index.php?topic=116917.0) save in a file, but i am too new to saving and stuff. I read the guide about that but it's too complicated for me. I just want a good example of that and i will learn.
I tried this:
pawn Code:
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);
}
Thanks.