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

Quote:
Originally Posted by KeyWay
Do i need to replace GivePlayerMoney etc. to GivePlayerCash etc. ?
You need to do that so the players wont get kicked when you use GivePlayerMoney
Just check if you start the timer, thats the SetTimer part
Reply
#22

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by KeyWay
Do i need to replace GivePlayerMoney etc. to GivePlayerCash etc. ?
You need to do that so the players wont get kicked when you use GivePlayerMoney
Just check if you start the timer, thats the SetTimer part
Well they dont get kicked when i give them money... And i didnt replace the GIvePlayerMoney, so it means this doesnt work?
Reply
#23

Quote:
Originally Posted by KeyWay
Well they dont get kicked when i give them money... And i didnt replace the GIvePlayerMoney, so it means this doesnt work?
No, that wanst what I meant
I meant, it looks like you forgot to start the timer

Quote:
Originally Posted by Norn
OnGameModeInit
pawn Code:
SetTimer("MoneyTimer", 1000, 0);
or you forgot to add

Quote:
Originally Posted by Norn
pawn Code:
forward MoneyTimer();
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
#24

No, i added everything that it says, it still doesnt work, maybe because im using Moneyz and NegativeMoneyz FS?
Reply
#25

Quote:
Originally Posted by KeyWay
No, i added everything that it says, it still doesnt work, maybe because im using Moneyz and NegativeMoneyz FS?
Ah, ok, after I read your message I looked through the code (before I just belived in the rightness of the post)
BUT there is an mistake

Quote:
Originally Posted by Norn
OnGameModeInit
pawn Code:
SetTimer("MoneyTimer", 1000, 0);
That should be

Quote:
Originally Posted by Norn
OnGameModeInit
pawn Code:
SetTimer("MoneyTimer", 1000, 1);
Note: The 1 instead of 0 because 1 (true) is the reapeating parameter, if it would be 0 the timer stops after his first call and wont work!
Reply
#26

Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by KeyWay
No, i added everything that it says, it still doesnt work, maybe because im using Moneyz and NegativeMoneyz FS?
Ah, ok, after I read your message I looked through the code (before I just belived in the rightness of the post)
BUT there is an mistake

Quote:
Originally Posted by Norn
OnGameModeInit
pawn Code:
SetTimer("MoneyTimer", 1000, 0);
That should be

Quote:
Originally Posted by Norn
OnGameModeInit
pawn Code:
SetTimer("MoneyTimer", 1000, 1);
Note: The 1 instead of 0 because 1 (true) is the reapeating parameter, if it would be 0 the timer stops after his first call and wont work!
Thanks! It works now.

But what if i have FS using GivePlayerMoney etc. ?
I need to make timer and all that IN to FS too?
Reply
#27

Good Tuto

pawn Code:
stock GivePlayerCash(playerid,cash)
    SetPVarInt(playerid,"SSM",GetPVarInt(playerid,"SSM")+cash);
   
stock UpdatePlayerMoney(playerid)
    if(GetPVarInt(playerid,"SSM") < GetPlayerMoney(playerid))
        GivePlayerMoney(playerid,GetPVarInt(playerid,"SSM")-GetPlayerMoney(playerid));

public OnPlayerUpdate(playerid)
    UpdatePlayerMoney(playerid);
Reply
#28

Could put BanEx(playerid.. );
But useful. Like in some roleplay servers, I saw this.
Reply
#29

Quote:
Originally Posted by cristofer
View Post
Code:
\samp02Xserver.win32\gamemodes\aaaa.pwn(2105) : warning 235: public function lacks forward declaration (symbol "MoneyTimer")
How can i fix this ?
make a forward like

[pawno]
//timer
forward MoneyTimer();
[/pawno]

on the very top of the script
Reply
#30

Hello I have one problem sometimes when u buy something money come back for you after relog' or sometime... I use: GivePlayerCash(playerid, -12); example. I didin't edit anything so can't understand where's the problem.
Reply
#31

awesome But not In A RolePlay GameMode In RolePlay you Need to Work Hard For Cash not here free when they try to hack they are ******* all items are now free then what will they do to the hacked money lol
Reply
#32

@ Norn

what if i save money to a file? Then now i add this, Will it reset the saved/file money to 0 and start again?

Please reply
Reply
#33

Nice tutorial
Reply
#34

Thanks nice one u helped me out
Reply
#35

pawn Code:
I:\Games\RockStar Game Gta San Andreas\Gta Sanandreas\My Script\gamemodes\MyScript.pwn(687) : warning 235: public function lacks forward declaration (symbol "MoneyTimer")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Any Solution?
script
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
#36

Quote:
Originally Posted by Roomeo
View Post
pawn Code:
I:\Games\RockStar Game Gta San Andreas\Gta Sanandreas\My Script\gamemodes\MyScript.pwn(687) : warning 235: public function lacks forward declaration (symbol "MoneyTimer")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Any Solution?
script
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);
            }
        }
    }
}
You must forward MoneyTimer due to its custom function, to do this simply add

Code:
forward MoneyTimer();
at the top of your script or before public MoneyTimer()
Reply
#37

Didn't even notice but the timer hadn't been set on repeat, updated haha.
Reply
#38

Work Good Thanks Man
Reply
#39

how do I do if I give money / givemoney / or money orders admin etc. not to drop money, I would like the casino and win money to stay there without disappearing, will help me rot. THX
Reply
#40

Good tutorial, but how do you like give the player money?

Like if I want to give someone money I do /givemoney?
How I'll give him?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)