House Storage? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: House Storage? (
/showthread.php?tid=577626)
House Storage? -
MohammedZ - 12.06.2015
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;
}
Re: House Storage? -
MohammedZ - 13.06.2015
Anybody?
Re: House Storage? -
Ritzy2K - 13.06.2015
i dont see any arguement for houseid? no house id is specific.. it ll deposit in every home?
Re: House Storage? -
MohammedZ - 13.06.2015
Yes it deposits in every home
Re: House Storage? -
Alpay0098 - 13.06.2015
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.
Re: House Storage? -
MohammedZ - 13.06.2015
I was thinking about that Thanks.