How to make players now lose money on death - 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: How to make players now lose money on death (
/showthread.php?tid=317168)
How to make players now lose money on death -
malcomjones - 10.02.2012
Hey i want to know how can i not make a player lose money on death if they used /kill or /changeteam(a cmd we made to put players back in class selection) If a player kills there self i dont want them to lose money how can i make that happen?
Re: How to make players now lose money on death -
Think - 10.02.2012
You could use a variable to check wether they used one of those commands (IE: playerKilledSelf[MAX_PLAYERS]) and at OnPlayerDeath check if its 1 or 0, if it was 1 don't take money.
PHP код:
new playerKilledSelf[MAX_PLAYERS];
if(!strcmp(cmdtext, "/kill", true))
{
playerKilledSelf[playerid] = 1;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerKilledSelf[playerid] == 1)
{
playerKilledSelf[playerid] = 0;
}
else
{
GivePlayerMoney(playerid, -500);
}
}
Just a simple example of one way to do this
Re: How to make players now lose money on death -
Konstantinos - 10.02.2012
I confused a bit. Do you mean everytime someone dies normally to loose his money, but if he type a command for example /kill not to loose the money. If I understand correct then you can make a global variable and everytime players type the command you want to use set the variable to 1 and check OnPlayerDeath Callback if the player who died had the variable not equal to 1 then GivePlayerMoney the amount you want.
Edit: Person above me was faster!
Re: How to make players now lose money on death -
malcomjones - 10.02.2012
Quote:
Originally Posted by Dwane
I confused a bit. Do you mean everytime someone dies normally to loose his money, but if he type a command for example /kill not to loose the money. If I understand correct then you can make a global variable and everytime players type the command you want to use set the variable to 1 and check OnPlayerDeath Callback if the player who died had the variable not equal to 1 then GivePlayerMoney the amount you want.
Edit: Person above me was faster!
|
Yes if the player uses the command to commit suicide i wint them to not lose money
Re: How to make players now lose money on death -
[LoF]Zak - 10.02.2012
Quote:
Originally Posted by malcomjones
Yes if the player uses the command to commit suicide i wint them to not lose money
|
Use the code 'Think' submitted. If you still need help, reply and i'll give you some help.
Re: How to make players now lose money on death -
malcomjones - 10.02.2012
But thanks anyways it helped
Re : How to make players now lose money on death -
ricardo178 - 10.02.2012
Well they are right but as far as you don't look to know much, just make it give player they money he is going to lose using GivePlayerMoney(playerid, money);
Not the best thing, but maybe the best one for you.