When player dies money resets -
captainjohn - 02.04.2012
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;
}
Re: When player dies money resets -
Face9000 - 02.04.2012
pawn Код:
new mrand =random(7500);
GivePlayerMoney(playerid,-mrand);
Re: When player dies money resets -
captainjohn - 02.04.2012
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.
Re: When player dies money resets -
TzAkS. - 02.04.2012
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;
}
Re: When player dies money resets -
captainjohn - 02.04.2012
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).
Re: When player dies money resets -
blank. - 02.04.2012
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?
Re: When player dies money resets -
captainjohn - 02.04.2012
Yes I do.
Do I need to add something to OnPlayerSpawn?
Re: When player dies money resets -
blank. - 02.04.2012
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?
Re: When player dies money resets -
captainjohn - 02.04.2012
Still resets everything whilst using the gamemode and the admin script.
I unloaded all other scripts.
Re: When player dies money resets -
Itzhak E. - 02.04.2012
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;
}