My code doesn't give cash to the owner, need help! -
Sc0pion - 30.03.2015
Fixed!
Re: My code doesn't give cash to the owner, need help! -
BleverCastard - 30.03.2015
pawn Код:
GivePlayerMoney(playerid, += hInfo[houseid][Price]);
You shouldn't really use GivePlayerMoney as it can be used towards money hacking.
Re: My code doesn't give cash to the owner, need help! -
Runn3R - 30.03.2015
That array is so wrong. 256 is too much.
Who saves owners by playerid? w00t And why do you use dini for f sake?
Re: My code doesn't give cash to the owner, need help! -
Sc0pion - 30.03.2015
Fixed!
Re: My code doesn't give cash to the owner, need help! -
BleverCastard - 30.03.2015
Quote:
Originally Posted by Sc0pion
You misunderstood, assume you own a house, set that house for sale and a guy purchases it the owner you wont receive the cash.
and the problem is with this part so I need to know how to fix:
Код:
GivePlayerMoney(hInfo[houseid][Owner], hInfo[houseid][Price]);
|
Like I said, don't use GivePlayerMoney, instead use a custom stock to stop money hacking.
pawn Код:
GiveMoney(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
return true;
}
Now, you can use
pawn Код:
PlayerInfo[playerid][pCash] += hInfo[houseid][Price];
GiveMoney(playerid);
Also, remember to always "+=" if you're adding money and "-=" if you're minus-ing money.
Re: My code doesn't give cash to the owner, need help! -
Sc0pion - 30.03.2015
Fixed!
Re: My code doesn't give cash to the owner, need help! -
BleverCastard - 30.03.2015
Quote:
Originally Posted by Sc0pion
I have anti-money hack already and after adding what you want me to, I receive a new error:
Код:
(781) : error 017: undefined symbol "PlayerInfo"
(781) : warning 215: expression has no effect
(781) : error 001: expected token: ";", but found "]"
(781) : error 029: invalid expression, assumed zero
(781) : fatal error 107: too many error messages on one line
And wont that code effect with this one?
Код:
GivePlayerMoney(playerid, -hInfo[houseid][Price]);
I mean first the owner receives the cash when a player buys his/her house and then the one who buys house looses the the cash.
|
I didn't write the code so you can literally throw it into your script and assume it would work. Edit it to your needs(pInfo?) and take a look through the code.
And no it won't, using GivePlayerMoney can be exploited by third-party hacks, since it's what the client uses to give a player money.
As for:
Код:
GivePlayerMoney(playerid, -hInfo[houseid][Price]);
You would do PlayerInfo[playerid][pCash] -= hInfo[houseid][Price]; and then GiveMoney(playerid);
Re: My code doesn't give cash to the owner, need help! -
Sc0pion - 30.03.2015
Fixed.
Re: My code doesn't give cash to the owner, need help! -
BleverCastard - 30.03.2015
Quote:
Originally Posted by Sc0pion
Sorry, I didn't understand but I tried once hacking my own server didn't work.
|
If you don't understand(the code I've given you is easy to understand) then you're not gonna get far with your script.
Your enums, are they
pInfo[playerid][...] or
PlayerInfo[playerid][...] or different?
You tell me.
Re: My code doesn't give cash to the owner, need help! -
Sc0pion - 30.03.2015
Fixed!