Death -$100
#1

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

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     new money = GetPlayerMoney(playerid);
     SetPlayerMoney(playerid, money-*Amount of cash to be withdrawn*);
     return 1;
}
Reply
#3

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

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!
Reply
#5

or

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     GivePlayerMoney(playerid, -*Amount of cash to be withdrawn*);
     return 1;
}
Reply
#6

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

Quote:
Originally Posted by TheMightyEddy
Посмотреть сообщение
What's the difference though?
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.
Reply
#8

.pwn and .amx will have less kb and code will be faster. :P
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)