SA-MP Forums Archive
Takes too much money on death - 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: Takes too much money on death (/showthread.php?tid=404088)



[SOLVED] Takes too much money on death - Sydcul - 01.01.2013

Hello,

To start off with, happy 2013 everyone!

I have a TDM gamemode. I made it so that when you get killed, you lose money. But it seems to take my set amount and another $100, no matter what my set amount is. It's very strange. I don't get any warnings or errors whatever when compiling, it just takes too much money. It might also be interesting to know that it takes the correct amount of money when you are in the death screen when you fade out of the dead character, but it takes the $100 when you spawn.
Not sure where i made a fault, just posted the whole GM, only 400 lines (without carspawns) http://pastebin.com/svgMae79.

Any help would REALLY be appreciated, i like the people here on the forum, but i'm not so good at SA-MP scripting myself so that's why i don't contribute.

SOLVED: It seems that GTA removes the $100 as a hospital/cop bribe, so i don't have to, i'll just add $100 in case of a teamkill.

-Sydcul


Re: Takes too much money on death - aslan890 - 01.01.2013

Hi bro how much did you set the money? + How much much money does it give?

Check lines: CTFL + F and type this GivePlayerMoney


Код:
{
        if(killerid == INVALID_PLAYER_ID) {
                SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
                GivePlayerMoney(playerid, -100);
                SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
        } else if(gTeam[killerid] == gTeam[playerid]) {
            SetPlayerScore(killerid,GetPlayerScore(killerid)-2);
            GivePlayerMoney(killerid, -50);
            SendDeathMessage(killerid,playerid,reason);
        } else {
            GivePlayerMoney(playerid, -100);
            SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
        SendDeathMessage(killerid,playerid,reason);
                SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
                GivePlayerMoney(killerid, 100);
        }
        return 1;
}



Re: Takes too much money on death - Sydcul - 01.01.2013

Quote:
Originally Posted by aslan890
Посмотреть сообщение
Hi bro how much did you set the money? + How much much money does it give?

Код:
{
        if(killerid == INVALID_PLAYER_ID) {
                SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
                GivePlayerMoney(playerid, -100);
                SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
        } else if(gTeam[killerid] == gTeam[playerid]) {
            SetPlayerScore(killerid,GetPlayerScore(killerid)-2);
            GivePlayerMoney(killerid, -50);
            SendDeathMessage(killerid,playerid,reason);
        } else {
            GivePlayerMoney(playerid, -100);
            SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
        SendDeathMessage(killerid,playerid,reason);
                SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
                GivePlayerMoney(killerid, 100);
        }
        return 1;
}
SUICIDE: -1 score, -$100
TEAMKILL: -2 killer score, -$50 killer
NORMAL KILL: -1 victim score, -$100 victim, +1 killer score, +$100 killer
It's very easy to obtain from the code, tho.

EDIT:
Quote:

Check lines: CTFL + F and type this GivePlayerMoney

Well, the shops and the OnPlayerDeath. But why don't you look at it?


Re: Takes too much money on death - Sydcul - 01.01.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
The extra 100 is removed by GTA on every death for police bribe/hospital costs.
Thanks. Then i guess i don't have to remove the $100 on death, i better give them back in case of a teamkill.

Off-Topic: I really like y_ini, nice!