SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/08/2015, 08:22 AM   #1
JeaSon
Gangsta
 
JeaSon's Avatar
 
Join Date: Aug 2013
Location: Future
Posts: 558
Reputation: 79
Default Server Sided money problem

hello everyone so tittle says all i have problem in my server sided money hack it adds money when somone respawn or kill himself
like ihve $60 and after respawn it will be $120

60 + 60 = 120 ( after respawn) and again respawn it will be ( 120 + 120 = 240) what is the problem


PHP Code:

#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney

GivePlayerCash(playeridmoney)
{
    
pInfo[playerid][Money] += money;
    
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
    
UpdateMoneyBar(playerid,pInfo[playerid][Money]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    
return pInfo[playerid][Money];
}
SetPlayerCash(playeridmoney)
{
    
pInfo[playerid][Money] = money;
    
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
    
UpdateMoneyBar(playerid,pInfo[playerid][Money]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    
return pInfo[playerid][Money];
}
ResetPlayerCash(playerid)
{
    
pInfo[playerid][Money] = 0;
    
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
    
UpdateMoneyBar(playerid,pInfo[playerid][Money]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    
return pInfo[playerid][Money];
}
GetPlayerCash(playerid)
{
    return 
pInfo[playerid][Money];
}

function 
MoneyTimer()
{
    new 
str[64];
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
GetPlayerCash(i) < GetPlayerMoney(i))
            {
                
ResetMoneyBar(i);//Resets the money in the M4 moneybar, Do not remove!
                
UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
                
new hack GetPlayerMoney(i) - GetPlayerCash(i);
                
format(strsizeof(str),"AC ALERT: %s (ID:%d) has cheated $%d",GetName(i),i,hack);
                
printf("%s has picked up/attempted to spawn $%d."GetName(i),hack);
            }
        }
    }
    return 
1;
}


// under onplayerspawn
    
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
    
GivePlayerCash(playerid,pInfo[playerid][Money]);

// under onplayerconnect
    
ResetPlayerCash(playerid); //Resetting the players cash variable to zero. 
__________________
Again back
JeaSon is offline   Reply With Quote
Old 20/08/2015, 11:50 AM   #2
_Mohit_
Big Clucker
 
Join Date: Sep 2012
Location: India
Posts: 83
Reputation: 5
Default Re: Server Sided money problem

Code:
// under onplayerspawn 
    ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove! 
    GivePlayerCash(playerid,pInfo[playerid][Money]);
You are adding money to the player when he spawns.Dont use "GivePlayerCash" under onplayerspawn,instead use "SetPlayerCash"

And another advice

Code:
if(GetPlayerCash(i) < GetPlayerMoney(i)) 
            { 
                ResetMoneyBar(i);//Resets the money in the M4 moneybar, Do not remove! 
                UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove! 
                new hack = GetPlayerMoney(i) - GetPlayerCash(i); 
                format(str, sizeof(str),"AC ALERT: %s (ID:%d) has cheated $%d",GetName(i),i,hack); 
                printf("%s has picked up/attempted to spawn $%d.", GetName(i),hack); 
            }
Buying drinks from vendor machines also triggers the anti cheat.And if the player cant get any use from the money,Why print it?
Just reset his money

Code:
if(GetPlayerCash(i) < GetPlayerMoney(i)) 
            { 
                ResetMoneyBar(i);
                UpdateMoneyBar(i,GetPlayerCash(i));
            }
_Mohit_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing money with a FS using server sided money Blademaster680 Scripting Help 8 19/08/2013 01:18 PM
Server sided money. [Problem] MrPlatinum Scripting Help 11 01/10/2012 12:06 PM
[Include] money.inc - Advanced, plug-n-play, server-sided money system fiki574 Includes 7 25/02/2012 10:47 PM
[Include] Server-sided Money - Stop money hackers! NEW RELEASE(v6) x-cutter Includes 107 30/08/2011 08:56 PM


All times are GMT. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.