SA-MP Forums Archive
Money and Respawning - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Money and Respawning (/showthread.php?tid=184508)



Money and Respawning - Brickwood - 20.10.2010

When the game starts, the player is given 1k, for example..
But I don't want them to get that money back when they die, I want them to lose 100 each death, how do I make sure they don't get 1k back each time they die?


Re: Money and Respawning - ••• ĤБĶБM ••• - 20.10.2010

Search for "OnPlayerDeath"

Under:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
Add:
pawn Код:
GivePlayerMoney(playerid, -100);
Pretty simple.


Re: Money and Respawning - Brickwood - 20.10.2010

Quote:
Originally Posted by ••• ĤБĶБM •••
Посмотреть сообщение
Search for "OnPlayerDeath"

Under:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
Add:
pawn Код:
GivePlayerMoney(playerid, -100);
Pretty simple.
I thought it was that simple too, but it wasn't..

It goes down to 900 then back to 1k.


Re: Money and Respawning - randomkid88 - 20.10.2010

Under which function are you giving them the money? Is it under OnPlayerSpawn? If so, you need to make a variable and assign it values when they die. For example:
pawn Код:
// At the top:
new pDied[MAX_PLAYERS] = 0; //or whatever you want to name it
public OnPlayerSpawn(playerid)
{
     if(!pDied[playerid])
     {
         GivePlayerMoney(playerid, 1000);
     }
     if(pDied[playerid])
     {
         pDied[playerid] = 0;        
      }
  return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(playerid, -100);
    pDied[playerid] = 1;
    return 1;
}



Re: Money and Respawning - Badger(new) - 20.10.2010

Quote:
Originally Posted by randomkid88
Посмотреть сообщение
Under which function are you giving them the money? Is it under OnPlayerSpawn? If so, you need to make a variable and assign it values when they die. For example:
pawn Код:
// At the top:
new pDied[MAX_PLAYERS] = 0; //or whatever you want to name it
public OnPlayerSpawn(playerid)
{
     if(!pDied[playerid])
     {
         GivePlayerMoney(playerid, 1000);
     }
     if(pDied[playerid])
     {
         pDied[playerid] = 0;        
      }
  return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(playerid, -100);
    pDied[playerid] = 1;
    return 1;
}
You could just give the player 1000 when they connect.
pawn Код:
public OnPlayerConnect(playerid){
    GivePlayerMoney(playerid,1000);
    return 1;
}
public OnPlayerDeath(playerid,killerid,reason){
    GivePlayerMoney(playerid,-100);
    return 1;
}



Re: Money and Respawning - Dj_maryo1993 - 20.10.2010

Mowst probabily you have an anticheat system that automaticly give back the money you just taked .
So
GivePlayerMoney(playerid,-100) will give -100 $ but your anticheat detect that value and give it back.
So check what function is your anticheat using .(mowst of them do something like SafeGivePlayerMoney )
If you are using an gf edit or an rp try searching for an command that gives you money ingame , like /giveplayermoney , and get the structure of the function from there

Then do like ••• ĤБĶБM ••• said , but instead of GivePlayerMoney put the structure of your anticheat.


Re: Money and Respawning - Hiddos - 20.10.2010

A player automatically loses $100 on death, use PVars to check if the player has already gotten the 1K.


Re: Money and Respawning - ••• ĤБĶБM ••• - 20.10.2010

Quote:
Originally Posted by Brickwood
Посмотреть сообщение
When the game starts, the player is given 1k, for example..
But I don't want them to get that money back when they die, I want them to lose 100 each death, how do I make sure they don't get 1k back each time they die?
Goes back to $1,000? This explains that your anti-cheat is giving back the money, the creator of the anti-cheat should of told you to replace all GivePlayerMoney, with he's function.

If he didn't tell you it, just go through he's anti-cheat script and find it out.