When player dies money resets
#1

I know this is a noob question but I'm not sure why it's doing it.



When a player dies I want them to lose X amount of money but when they do, their money gets reset to $0.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{  

    GivePlayerMoney(killerid, 7500);
    new mrand =random(10000);
    GivePlayerMoney(playerid,-mrand);
    }
    return 1;
}
Reply
#2

pawn Код:
new mrand =random(7500);
    GivePlayerMoney(playerid,-mrand);
Reply
#3

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
pawn Код:
new mrand =random(7500);
    GivePlayerMoney(playerid,-mrand);
That's just the same apart from that takes -7500 at max.

I want it where the player who dies doesn't get there money reset to $0 if they have $200,000. I want it so it takes away $7500 max.
Reply
#4

I don`t understand this
Quote:

I want it where the player who dies doesn't get there money reset to $0 if they have $200,000. I want it so it takes away $7500 max.

Do you mean like if player has 5000 and dies to reset money to 0?And and do not give with - ?


Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(GetPlayerMoney(playerid) <= 7500)
	{
	    GivePlayerMoney(killerid, 7500);
		SetPlayerMoney(playerid, 0);
	}
	else
	{
	    GivePlayerMoney(killerid, 7500);
	    new mrand =random(10000);
	    GivePlayerMoney(playerid,-mrand);
    }
    return 1;
}
Reply
#5

No.

My current situation is this. When a player in my server dies, their money gets reset to $0.

I want it where it does this.
When a player dies they should only have be charged $7500 for their death.

So lets say Player X has $50,000.
Player Y kills Player X.
Player X should then have $42,500.
As that's $50,000 - $7,500 (due to death).
Reply
#6

Quote:
Originally Posted by captainjohn
Посмотреть сообщение
No.

My current situation is this. When a player in my server dies, their money gets reset to $0.

I want it where it does this.
When a player dies they should only have be charged $7500 for their death.

So lets say Player X has $50,000.
Player Y kills Player X.
Player X should then have $42,500.
As that's $50,000 - $7,500 (due to death).
Do you have any filterscripts loaded?
Reply
#7

Yes I do.


Do I need to add something to OnPlayerSpawn?
Reply
#8

Quote:
Originally Posted by captainjohn
Посмотреть сообщение
Yes I do.


Do I need to add something to OnPlayerSpawn?
One of them may be the cause of this reset, are you testing everything on bare?
Reply
#9

Still resets everything whilst using the gamemode and the admin script.

I unloaded all other scripts.
Reply
#10

I think that I understood you..
PHP код:
new bool:Dead[MAX_PLAYERS]; 
in
PHP код:
OnPlayerDeath(playerid)
{
Dead[playerid] == true;
return 
1;

now in
PHP код:
OnPlayerSpawn(playerid)
{
if(
Death[playerid] == true)
{
// your code.
    
new mrand =random(10000);
    
GivePlayerMoney(playerid,-mrand);
}
return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)