House Storage?
#1

Okay So i made a house storage system were you can deposit money but the prob is the money gets saved for all the houses not the playerid's house only

Ex: Private deposited 5 $ into his house
C0d3r checked his house wealth and found that he has 5$ in it
i need it to be saved for the player's house only.


Код:
CMD:hdeposit(playerid, params[])
{
        new string[2001], money;
        new houseid;
		if(sscanf(params, "i",money)) return SendClientMessage(playerid, RED, "Usage: /hdeposit [Money]");
		if(GetPlayerCash(playerid) < 1) return SendClientMessage(playerid, RED, "You dont have any cash to deposit into Your house");
		if(GetPVarInt(playerid, "IsInHouse") == 0) return SendClientMessage(playerid, RED, "You need to be in a house to use this command.");
		if(strcmp(GetHouseOwner(GetPVarInt(playerid, "LastHouseCP")), GetName(playerid), false)) return SendClientMessage(playerid, RED, "You dont own this house.");
		{
        HouseInfo[houseid][hMoney] + money;
        format(string,sizeof(string),"You have deposit in the safe $%d.Now you have $%d",money,HouseInfo[playerid][houseid][hMoney]);
        SendClientMessage(playerid,-1,string);
        SaveHouseStats(houseid);
        GivePlayerCash(playerid, -money);
        }
		return 1;
}

CMD:hwithdraw(playerid, params[])
{
        new houseid;
        new string[2000], money;
		if(sscanf(params, "i",money)) return SendClientMessage(playerid, RED, "Usage: /hwithdraw [Money]");
		if(HouseInfo[houseid][hMoney] < 1) return SendClientMessage(playerid, RED, "You dont have any money in Your house storage");
		if(GetPVarInt(playerid, "IsInHouse") == 0) return SendClientMessage(playerid, RED, "You need to be in a house to use this command.");
		if(strcmp(GetHouseOwner(GetPVarInt(playerid, "LastHouseCP")), GetName(playerid), false)) return SendClientMessage(playerid, RED, "You dont own this house.");
		{
        HouseInfo[houseid][hMoney] - money;
        GivePlayerCash(playerid, money);
		format(string,sizeof(string),"You have take from Your house safe $%d. Money in your safe = $%d.",money,HouseInfo[houseid][hMoney]);
        SendClientMessage(playerid,-1,string);
        SaveHouseStats(houseid);
        }
		return 1;
}
Reply
#2

Anybody?
Reply
#3

i dont see any arguement for houseid? no house id is specific.. it ll deposit in every home?
Reply
#4

Yes it deposits in every home
Reply
#5

Why did you do that?
You could make it like PVar and everytime that player Deposit/Withdraw money, this variable changes.
And it just changes player's own house money.
Just Remove Stroage System and Give It to the Player's Variables. That's it!
If I were in your shoes , I would do like above.
Reply
#6

I was thinking about that Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)