That does not work at all. My command looks like this now:
Код:
dcmd_buy(playerid,params[])
{
#pragma unused params
new str[255],str1[255],pname[24], housenumber;
housenumber = GetHouseID(playerid);
if(housenumber == -1) return SendClientMessage(playerid, COLOR_ADMIN, "*** Nie jestes w ikonce domu!");
GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if(dini_Exists(str1))
{
if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, COLOR_YELLOW, "*** Możesz kupić tylko jeden dom!");
}
format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, COLOR_YELLOW, "*** Ten dom nie jest na sprzedaż!");
if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, COLOR_ADMIN, "*** Nie masz wystarczająco pieniędzy przy sobie!");
SendClientMessage(playerid, COLOR_GREEN, "*** Gratulacje, własnie stałes się włascicielem tej parceli! Wpisz /househelp aby zobaczyć komendy własciciela domu!");
format(str, sizeof(str), "%s has bought houseid 0",pname);
print(str);
GivePlayerMoney(playerid, -hInfo[housenumber][Cost]);
dini_Set(str1, "Name", pname);
dini_IntSet(str1, "Cash", GetPlayerMoney(playerid));
hInfo[housenumber][Name]=pname;
hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
new Float:sy, Float:sx, Float:sz;
dini_IntSet(str1, "Houseid", housenumber);
if(!dini_Isset(str1,"Rentid"))
{
dini_IntSet(str1, "Rentid", -255);
}
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(str1, "SpawnX", sx);
dini_FloatSet(str1, "SpawnY", sy);
dini_FloatSet(str1, "SpawnZ", sz);
dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
DestroyPickup(HousePickup[housenumber]);
HousePickup[housenumber] = CreatePickup(1272, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
return 1;
}
I changed it from ''money'' to ''Cash'' since it is Cash in the script, but I think you're wrong, since it is not updating the user file. I dont think we have told it what file it should update but how to do that? :S (If I am of course correct, which I aint sure of...)