[TUTORIAL] Serverside Money. (Impossible to hack)
#1


Serverside Money Tutorial

Information:
* This tutorial was intended for roleplay gamemodes.
* This will not work with clientside features, etc stunt bonuses, sprunk machines and burger shot, they will just be able to purchase stuff for free.


Functions:
pawn Code:
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney

new Cash[MAX_PLAYERS];

stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}
OnPlayerConnect
pawn Code:
ResetPlayerCash(playerid); //Resetting the players cash variable to zero.
OnGameModeInit
pawn Code:
SetTimer("MoneyTimer", 1000, 1);
Money check timer, this will reset there money to there serverside money if they attempted to hack/picked up money in an interior.
pawn Code:
public MoneyTimer()
{
    new username[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                ResetMoneyBar(i);//Resets the money in the original 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);
                GetPlayerName(i,username,sizeof(username));
                printf("%s has picked up/attempted to spawn $%d.", username,hack);
            }
        }
    }
}
Reply
#2

I'm using it, its awesome.

Thank you Norn
Reply
#3

Thats The way to do it! Nice tut norn!
Reply
#4

Quote:
Originally Posted by Norn
[TUTORIAL] Serverside Money. (Impossible to hack)
Its not impossible, but it is very hard for a noob to do
I wont get into the details, but if you wanna know PM me and I will explain.
Reply
#5

the only usefull in this topic is the timer code, the definitions are stupid and the function could be definitions, so it would be faster
Reply
#6

Quote:
Originally Posted by
the only usefull in this topic is the timer code, the definitions are stupid and the function could be definitions, so it would be faster
Bit harsh.
Reply
#7

Quote:
Originally Posted by pıʞoɹʎd
Quote:
Originally Posted by
the only usefull in this topic is the timer code, the definitions are stupid and the function could be definitions, so it would be faster
Bit harsh.
I know but somethings like "unhackable money" got asked thousonds of times in this forums, people just need to search.
I think this topic is more or less unneeded, the best is to post the code in usefull snippets.
Reply
#8

Quote:
Originally Posted by Kinetic
Quote:
Originally Posted by Norn
[TUTORIAL] Serverside Money. (Impossible to hack)
Its not impossible, but it is very hard for a noob to do
I wont get into the details, but if you wanna know PM me and I will explain.
How can you hack it, it's stored in the server lol.

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by pıʞoɹʎd
Quote:
Originally Posted by
the only usefull in this topic is the timer code, the definitions are stupid and the function could be definitions, so it would be faster
Bit harsh.
I know but somethings like "unhackable money" got asked thousonds of times in this forums, people just need to search.
I think this topic is more or less unneeded, the best is to post the code in usefull snippets.
I posted this exact thread here several months ago when such a thread never existed, i decided to repost it as it was missing (I deleted it).

As said before several times, if you don't like it don't use it. It's simply here to help people that don't have a clue.
Reply
#9

i need a code if someone use money hack it should send messages to admins
Reply
#10

haha - Few days ago i did really the same functions myself. (for my cash anti-cheat[i also have weapon,health & armor])
Well made!, thou there is no other way to do this

p.s. It is impossible to hack this, if you think otherwise, then you are an retard.
(It is possible via catching the variable packet, but it is practically impossible to find out which variable to set to something + i believe only 2-3 coders on this forum can script that).

Quote:
Originally Posted by ArTisT
i need a code if someone use money hack it should send messages to admins
pawn Code:
public MoneyTimer()
{
    new username[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                ResetMoneyBar(i);//Resets the money in the original 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);
                GetPlayerName(i,username,sizeof(username));
                printf("%s has picked up/attempted to spawn $%d.", username,hack);
                 if(Admin[playerid > 0)
                 {
                    SendClientMessage(playerid,COLOR_WHITE,"Some one money hacked!");
                 }
            }
        }
    }
}
For getting/setting name use format() (search wiki)

Luxeon
Reply
#11

i know how you can hack this...but i dont know HOW i just know how its done...lol if u get wat i mean
Reply
#12

Quote:
Originally Posted by Mowgli
i know how you can hack this...but i dont know HOW
did you understand yourself ..eh?
Reply
#13

ye...cos like...i know the idea of how to hack it i just dont know how its done
Reply
#14

Quote:
Originally Posted by Mowgli
ye...cos like...i know the idea of how to hack it i just dont know how its done
If you don't know how to make it, you can put it into your ass, as idea nowadays is nothing.
Reply
#15

Quote:
Originally Posted by Luxeon
you are an retard.
Priceless...


Hacking to make it higher isn't impossible, because a good hacker would just freeze the memory value of money. Although I wouldn't suggest that, as freezing your money to a certain value is pretty obvious to admins. If I had to hack a server with this I would freeze it to what it already is, and then buy the things I want, specifically Car Mods, Health, and Weapons if an Ammunation is available.

A better anti-hack doesn't ban people, it would asses the probability of a person hacking and warn admins on that percentage rate.
Reply
#16

Quote:
Originally Posted by SilentHuntR
Hacking to make it higher isn't impossible, because a good hacker would just freeze the memory value of money. Although I wouldn't suggest that, as freezing your money to a certain value is pretty obvious to admins. If I had to hack a server with this I would freeze it to what it already is, and then buy the things I want, specifically Car Mods, Health, and Weapons if an Ammunation is available.

A better anti-hack doesn't ban people, it would asses the probability of a person hacking and warn admins on that percentage rate.
The 'hack' you have written about will not succeed on my server(script if to be correct) (just an example).
If your/vehicles health changes it will be auto set back to what it was, if it isn't done via the script. (why to punish a player, if you can just show him that his cheats don't work :P )
What about weapons? Close ammunations and make custom weapon shops.
In the sum you will see, that freezing money value wont always help. Creating a hack for a certain server sounds weird too(no lifer only will do that).
So i doubt such hack will be scripted.


Just to remind:
You wont be able to buy something worthy for normal cash (not server sided), as Good role play game modes do use custom shops etc.. .

kind regards,
Luxeon
Reply
#17

delete
Reply
#18

u are still using the old money addres, that makes this system vurnable.

i saw someone posting a topic that there isnt a way to do it otherwise.
u are wrong about that. there is 1 way that is completely secure, but takes up a little more coding then this.
basicly, u are using a timer for checking the money values. while this COULD eat massive amounts of memory, resulting crash.

note that ur code isnt complete, since it is possible to fill the gaps of the stunt bonuses, sprunk machines and burger shots etc. i am currently working on what i am talking about, but i dont know if i am going to release it...

anyways, for the moment, its good. or not since its intended for roleplay, which most use vending machines and stuff.

also, to improof ur current code, u can use interior worlds.
for example burger shot:
there is a specified interior world for burger shots.
well i know there isnt any meal with an higher price then 100.
so when a player is in that interior world and its gained money is higher then 100, it is meaning he cheats., since u cannot have stuntbonusses in that interior world because vehicles cannot move there.

since all other real payments are covered up with the costum function giveplayercash, u dont need to worry about money thats given programmatic.

for stunt bonusses, i dont remember well, but isnt it possible to disable/enable per player?
u can always create ur own mechanism for stunt bonusses.

and i happen to see this last post, about custom weapon shops.
no need, simply adept this current code to the interior world and prices.

note to Luxeon: no it isnt weird at all. its more then clever to test your own server its strength.
if u want to have a secure server, its only possible to know if u can hack yourself, or someone close by who can do it for you.and many of u people got the wrong idea about hacking. u are probably instantly thinking of people are using motifications in any way, and therefore ruining the game. most of u call them hackers.
wrong call. they arent called hackers, but scriptkiddies. there is no such thing as a evil hacker. since an hacker is educated and got better stuff to do, like finding security holes in like firewalls for money on assignment ( legal ).

and i highly doubt a scriptkiddie will script anything, since they simply download a excisting working trainer on the internet.
if anyone find itself a hacker, u may meet yourself the following points:
most likely knows programming ( i am not talking about scripting, as u should know the diffrence )
is not being illegal with skills, ( like cracking, deassembling, reverse engineering, hacking )
you get paid to do your job? ( a hacker can be out of work, but hey )

anyways if u do not meet these terms, u are not an hacker, but a scriptkiddie.
also note that, pawno is a game scripting langauge, not a programming langauge.

anyways back to topic:
nice work, keep it up!
Reply
#19

Why this doesnt help?

My friend spawned like 400k and didnt reseted.. What im doing wrong?
Reply
#20

Do i need to replace GivePlayerMoney etc. to GivePlayerCash etc. ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)