Money and Respawning
#1

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?
Reply
#2

Search for "OnPlayerDeath"

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

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.
Reply
#4

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;
}
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

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

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)