SA-MP Forums Archive
Weird money problem. - 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: Weird money problem. (/showthread.php?tid=579900)



Weird money problem. - b3nz - 30.06.2015

Somewhy GivePlayerMoney is called, but then seconds after all the money is being reset. I do not have any kind of anticheat or an include that would have one. The funny thing is that I'm not even using ResetPlayerMoney in the whole script.

pawn Код:
MySQL::OnPlayerProfileLoad (playerid)
{
        <...>pInfo [playerid][pMoney] = cache_get_field_content_int (0, "Money");

    SendFormattedClientMessage (playerid, col_WHITE, "before %d", pInfo [playerid][pMoney]);
    GivePlayerMoney (playerid, pInfo [playerid][pMoney]);
    SendFormattedClientMessage (playerid, col_WHITE, "after %d", pInfo [playerid][pMoney]);

        <...>
Although if I use a command to give player some money, the server doesn't take it away.


Re: Weird money problem. - kloning1 - 30.06.2015

maybe you use server side money?
if you use filterscript, check it


Re: Weird money problem. - Dizzle - 01.07.2015

Check your includes at the top of your script, there may be "MoneyHax" include to prevent players hacking their cash (if you DL-ed the GM and you dont know about this), if you have it, add it to all of your FS's as (#include MoneyHax_FS) or either remove it from everywhere. Seems like you have an AC because it resets your cash, it only doesnt when you give them with AdminCmd right ?


Re: Weird money problem. - Sithis - 01.07.2015

There must be a (filter)script or include responsible for this behavior (or your own script). Money doesn't reset itself.


Re: Weird money problem. - b3nz - 01.07.2015

I found the problem - somehow it's fixes.inc. Looks like Im not the only one with such problem: click

Does anybody have an idea how to fix this without deleting the library?


Re: Weird money problem. - Suicidal.Banana - 01.07.2015

Create a new file in pawno, select everything and replace it with the code below:
Код:
// --- Fixes.inc Money Fixer ----------------- By: suicidal.banana
// Quick and dirty fix for money bug of fixes.inc, because why not
#include <a_samp>

new playerMoneyValues[MAX_PLAYERS],
    moneyFixDelay = 2500; // 1000 = 1 second

forward FixPlayerMoney(playerid);

public OnFilterScriptInit() {
    print("\n-=[ fixes.inc money fixer loaded! ]=-\n");
    return 1;
}
public FixPlayerMoney(playerid) {
    if(playerMoneyValues[playerid] && (playerMoneyValues[playerid] != 0)) {
        GivePlayerMoney(playerid, playerMoneyValues[playerid]);
    }
    return 1;
}
public OnPlayerSpawn(playerid) {
    SetTimerEx("FixPlayerMoney", moneyFixDelay, false, "i", playerid);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason) {
    playerMoneyValues[playerid] = GetPlayerMoney(playerid);
    return 1;
}
public OnPlayerDisconnect(playerid, reason) {
    playerMoneyValues[playerid] = 0;
    return 1;
}
public OnFilterScriptExit() {
    print("\n-=[ fixes.inc money fixer unloaded! ]=-\n");
    return 1;
}
Save it as filterscripts/fixes-inc-money-fixer.pwn, and compile it.
Now open your server.cfg file, find the filterscripts line and add fixes-inc-money-fixer too the end of it. Save and close the server.cfg file, start your server, go test.

If it works, hooray, if it doesn't work, try finetune the moneyFixDelay value at the top of the script


Re: Weird money problem. - Abagail - 01.07.2015

He doesn't need that, he already established the issue is with fixes.inc.


Re: Weird money problem. - Suicidal.Banana - 01.07.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
He doesn't need that, he already established the issue is with fixes.inc.
He said:
Quote:
Originally Posted by b3nz
Посмотреть сообщение
Does anybody have an idea how to fix this without deleting the library?
And what i posted is my idea


Re: Weird money problem. - b3nz - 02.07.2015

Thanks everyone! L&A this.


Re: Weird money problem. - Suicidal.Banana - 02.07.2015

If the fix worked, and nobody is responding too the issue i the fixes.inc thread, maybe post the code i gave you too that thread, so it can help others too