Explain me please
#1

I need a good server-side-money script and explain how to use it, will give+rep
Reply
#2

What sort of gamemode?
What is your current player information variable? (where you store data to be saved to a db/file)
Reply
#3

i use this

https://sampforum.blast.hk/showthread.php?tid=273088

And i plan to create a rp/dm gamemode based in los santos
Reply
#4

EDIT: Oh yeah, never mind. Didn't read the topic carefully enough, sorry
Reply
#5

Ahhh E'z

There's a very simple legacy way of controlling cash:
That is
GivePlayerMoney(playerid, amount);
For negative amounts:
GivePlayerMoney(playerid, -amount);

However with this system, people are gonna hack the shit out of your server.
What you want to do is use that [pCash] variable you are currently employing.

That is achieved by making a stock:

pawn Код:
stock GivePlayerMoneyEx(playerid, value)
{
  PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] + value;
  ResetPlayerMoney(playerid);
  GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
}
This basically means that your cash is actually based on [pCash] instead of the legacy moneybar, and the moneybar @ the HUD is just a display for your [pCash] variable.

So wherever you would use GivePlayerMoney() in your script, write it as GivePlayerMoneyEx().

Also, undertaking this system of money-control allows you to easily check for hacks.

under OnPlayerUpdate, run this block of code:

pawn Код:
if(GetPlayerMoney(playerid) > PlayerInfo[playerid][pCash])
        {
            new HackedAmount;
            HackedAmount = GetPlayerMoney(playerid) - PlayerInfo[playerid][pCash];
            OnPlayerHaveHackedMoney(playerid, HackedAmount);
        }
This will check if the value displayed on the moneybar is actually larger than the amount of cash the player has received via server functions. If it is? It will run OnPlayerHaveHackedMoney.

OnPlayerHaveHackedMoney is not a native function, so you will need to forward it:

pawn Код:
forward OnPlayerHaveHackedMoney(playerid, HackedAmount);
And then give it functionality.

pawn Код:
public OnPlayerHaveHackedMoney(playerid, value)
{
    new hacker[64];
    new string[128];
    GetPlayerName(playerid, hacker);
    if(value > 49) //what bonehead would try and hack less lmao
    {
        format(string, 256, "<A> HackWarning: [%d]%s attempted to spawn $%d.",playerid, hacker, value);
//you now have 'string' which contains ^^. Insert here your admin broadcast code
//here you also insert your disciplinary code, whether it be warn, Ban(playerid), Kick(playerid) or w/e
    }
}
If you don't feel the need to ban a player for attempting to moneyhack, you can run the following code in OnPlayerHaveHackedMoney:

pawn Код:
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
That will simply just reset their moneybar constantly to their [pCash] value and hopefully their frustration will encourage them to give up : D
Reply
#6

Thank you so much! +rep from me
Reply
#7

An RP/DM script as one? You've got to be kidding me..
Reply
#8

Quote:
Originally Posted by Steven82
Посмотреть сообщение
An RP/DM script as one? You've got to be kidding me..
CnR style... i just dont wannt to call it cnr
Reply
#9

Quote:
Originally Posted by Steven82
Посмотреть сообщение
An RP/DM script as one? You've got to be kidding me..
What is your problem? Your comment isn't even related this subject.

Dripac; The questions has been answered?
Reply
#10

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
What is your problem? Your comment isn't even related this subject.

Dripac; The questions has been answered?
My problem?

My problem: x + 12x - 17 ( 4 * 8 ) + 88 ( 8 * 9 )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)