Death -$100 - 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: Death -$100 (
/showthread.php?tid=330200)
Death -$100 -
TheMightyEddy - 31.03.2012
So I have tested my server and every time I die, I get charged $100 so (-$100). How can I change that so that whenever I die, I get charged more money? Thanks,
Re: Death -$100 -
introzen - 31.03.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new money = GetPlayerMoney(playerid);
SetPlayerMoney(playerid, money-*Amount of cash to be withdrawn*);
return 1;
}
Re: Death -$100 -
Jonny5 - 31.03.2012
find the
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
in your code and there you will see
it taking the 100. Just change to whatever you like.
Re: Death -$100 -
TheMightyEddy - 31.03.2012
Quote:
Originally Posted by introzen
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { new money = GetPlayerMoney(playerid); SetPlayerMoney(playerid, money-*Amount of cash to be withdrawn*); return 1; }
|
Yes this works. +rep. Thanks!
Re: Death -$100 -
DJGama101 - 31.03.2012
or
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
GivePlayerMoney(playerid, -*Amount of cash to be withdrawn*);
return 1;
}
Re: Death -$100 -
TheMightyEddy - 31.03.2012
Quote:
Originally Posted by DJGama101
or
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
GivePlayerMoney(playerid, -*Amount of cash to be withdrawn*);
return 1;
}
|
What's the difference though?
Re: Death -$100 - kikito - 31.03.2012
Quote:
Originally Posted by TheMightyEddy
What's the difference though? ![Confused](images/smilies/confused.png)
|
The last one is more fast than the other one.
Since you do not need to get the player money to remove 100$, the last one is better.
Re: Death -$100 -
DJGama101 - 31.03.2012
.pwn and .amx will have less kb and code will be faster. :P
Re: Death -$100 -
SpiritEvil - 31.03.2012
Quote:
Originally Posted by introzen
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { new money = GetPlayerMoney(playerid); SetPlayerMoney(playerid, money-*Amount of cash to be withdrawn*); return 1; }
|
"SetPlayerMoney" is not a valid function unless you have defined it by yourself, and therefore the script won't work.
What DJGama101 posted is correct.
Re: Death -$100 -
TheMightyEddy - 31.03.2012
Oh okay thanks. And last question. Anyone know how to subtract a certain amount of money depending on how much money you currently have?
For example:
I have $100000 but I died therefore my medical fees (or death fees) will be $10000
OR
I have $200000 but I died therefore my medical fees (or death fees) will be $20000
Anyone know how to do this?