SA-MP Forums Archive
Server side money not working - 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: Server side money not working (/showthread.php?tid=581132)



Server side money not working - Face9000 - 10.07.2015

Hello, i found this server side money method here on the forum and i applied it:

Код:
#define GivePlayerCash(%0,%1) SetPVarInt(%0,"Money",GetPlayerCash(%0)+%1),GivePlayerMoney(%0,%1)
#define ResetPlayerCash(%0) SetPVarInt(%0,"Money",0), ResetPlayerMoney(%0)
#define GetPlayerCash(%0) GetPVarInt(%0,"Money")
I replaced GivePlayerMoney with GivePlayerCash, ResetPlayerMoney with ResetPlayerCash and GetPlayerMoney with GetPlayerCash, but is not working.

I tried with a famous cheat and money doesn't get reset to the original quantity.

(I don't have any timer, just added this defines and replaced all original money variables.)

What's wrong?


Re: Server side money not working - JaKe Elite - 11.07.2015

Did you make sure you have the codes that will reset the hacker's money back to it's original money?


Re: Server side money not working - Prokill911 - 11.07.2015

PHP код:
public GetMoneyEx(playerid) {
    return 
GetPVarInt(playerid"Money");
}
public 
GiveMoneyEx(playeridmoney) {
    new 
bmoney GetMoneyEx(playerid);
    
bmoney += money;
    
SetPVarInt(playerid"Money"bmoney);
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridbmoney);

Try that.


Re: Server side money not working - Face9000 - 11.07.2015

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
Did you make sure you have the codes that will reset the hacker's money back to it's original money?
Emh no i don't have that code...

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
PHP код:
public GetMoneyEx(playerid) {
    return 
GetPVarInt(playerid"Money");
}
public 
GiveMoneyEx(playeridmoney) {
    new 
bmoney GetMoneyEx(playerid);
    
bmoney += money;
    
SetPVarInt(playerid"Money"bmoney);
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridbmoney);

Try that.
I don't need another custom variabe, i already have one.


Re: Server side money not working - Face9000 - 12.07.2015

Bump


Re: Server side money not working - Banana_Ghost - 12.07.2015

PHP код:
#define CheckPlayerCash(%0) if(GetPlayerMoney(%0) > GetPVarInt(%0,"Money")) ResetPlayerMoney(%0), GivePlayerMoney(%0,GetPVarInt(%0,"Money)) 
Use something along those lines, it might need editing (it's 6:37am). Place it either in a 1 second timer or under OnPlayerUpdate.


Re: Server side money not working - Vince - 12.07.2015

The money bar will not update as long as you don't do anything with the money. Cheated money is purely cosmetic in this sense; it only displays in the HUD. Yet as soon as you try to buy something the script will fall back to the server sided money.


Re: Server side money not working - Face9000 - 12.07.2015

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
PHP код:
#define CheckPlayerCash(%0) if(GetPlayerMoney(%0) > GetPVarInt(%0,"Money")) ResetPlayerMoney(%0), GivePlayerMoney(%0,GetPVarInt(%0,"Money)) 
Use something along those lines, it might need editing (it's 6:37am). Place it either in a 1 second timer or under OnPlayerUpdate.
Doesn't work.

Quote:
Originally Posted by Vince
Посмотреть сообщение
The money bar will not update as long as you don't do anything with the money.
Yes i know. I need the code to reset player's money when they are earned by cheats and not given by server..can you help me?


Re: Server side money not working - Face9000 - 12.07.2015

Fixed.