A small problem...
#1

Hey, I have a problem.
I have made a register and login system using DUDB and DINI, following a tutorial, and I have downloaded Antronix House System. Unfortunately, when I buy a house, it takes the money but when I return to the server and login back anytime, money that has been taken has not really been taken if you know what I mean. It like returned into the account, which shouldn't do and is pointless. Any reason or solution? I would be grateful for any help

Thanks and Regards
Puzi
Reply
#2

So when he buys a prop why did you not subtract that money from his file by using dini_set
Reply
#3

How to subtract that?
I think it is there because it takes the money away :P But I aint sure tbh. This is what it is...

Код:
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);
  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;
}
That would be the subtraction If i am not mistaken:
Код:
	GivePlayerMoney(playerid, -hInfo[housenumber][Cost]);
  dini_Set(str1, "Name", pname);
Reply
#4

Any help?
Reply
#5

yeah after GivePlayerMoney

use
Код:
dini_IntSet(str1, "money", GetPlayerMoney(playerid));
iam not sure but try something like this
Reply
#6

Код:
  dini_Set(str1, "Name", pname);
Replace this with yours or what?
Reply
#7

Quote:
Originally Posted by Puzi
Код:
  dini_Set(str1, "Name", pname);
Replace this with yours or what?
dont remove it if you are using for something else just add mine when player successfully buy a prop.
Reply
#8

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...)
Reply
#9

ok you was saying that iam using dini and dudb for it so i thought so should use folder aswell

Change it
Reply
#10

What do you mean?

I mean that the User Accounts are saved directly into scriptfiles folder with Cash=Amount inside them. It does not work on either ''money'' or ''Cash''. And the house information is saved into like a file for example houseid0 into scriptfiles/Houses folder and the single file contains all information about the house. So it's like two different directories and files, if you know what I mean.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)