16.09.2017, 22:02
hi guys! how to write my inventory save and load script MYSQL R41-2??
THANK YOU AND RESPECT!!!
Code:
THANK YOU AND RESPECT!!!
Code:
Код:
stock SaveItems(playerid) { new m[128]; format(itemfile,sizeof(itemfile),"/Inv/%s.ini",GetNamei(playerid)); for(new i; i<MAX_ITEMS; i++) { format(m,128,"Item%d",i); dini_Set(itemfile,m,ItemName[playerid][i]); format(m,128,"Itemamount%d",i); dini_IntSet(itemfile,m,ItemAmount[playerid][i]); } return 1; } stock LoadItems(playerid) { new m[128]; format(itemfile,sizeof(itemfile),"/Inv/%s.ini",GetNamei(playerid)); if(dini_Exists(itemfile)) { ResetPlayerItems(playerid); for(new i; i<MAX_ITEMS; i++) { format(m,128,"Item%d",i); new item[128]; format(item,128,"%s",dini_Get(itemfile,m)); format(ItemName[playerid][i],128,"%s",item); format(m,128,"Itemamount%d",i); ItemAmount[playerid][i] = dini_Int(itemfile,m); } } else { dini_Create(itemfile); ResetPlayerItems(playerid); SaveItems(playerid); } return 1; }