Need little help about this - 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: Need little help about this (
/showthread.php?tid=660049)
Need little help about this -
DarknesS1988 - 23.10.2018
Looking for someone who can teach me how to calculate -25% of the hit price (bounty). I know how to do this in math, but in pawno is little complicated for me and i need tips/examples how to do it
Codes:
PHP код:
format(string, sizeof(string), "Your $%d Hit Fee Has Been Returned, Minus A 25 Percent Processing Fee.",PlayerInfo[giveplayerid][pBounty]);
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
-25% goes here somewhere under giveplayermoney
PHP код:
GivePlayerMoney(playerid,PlayerInfo[giveplayerid][pBounty]);
PlayerInfo[giveplayerid][pBounty] = 0;
PlayerInfo[giveplayerid][pBountyHour] = 0;
PlayerInfo[giveplayerid][pBountyMinute] = 0;
PlayerInfo[giveplayerid][pBountyPlacedBy] = -1;
PlayerInfo[playerid][pBountyPlacedOn] = -1;
Giving reputation for help.
Re: Need little help about this -
Calisthenics - 23.10.2018
You find the amount and subtract it from original value.
fee = money * 25 / 100
money = money - fee
Re: Need little help about this -
DarknesS1988 - 25.10.2018
Quote:
Originally Posted by Calisthenics
You find the amount and subtract it from original value.
fee = money * 25 / 100
money = money - fee
|
Thanks, I have succesfully added fee to pBounty [hit price]
Re: Need little help about this -
DarknesS1988 - 25.10.2018
Quote:
Originally Posted by ******
Or the simpler way:
money = money * 75 / 100;
|
Tnx, but not needed anymore. I have succesfully created it.
PHP код:
fee = PlayerInfo[giveplayerid][pBounty] * 25 / 100;
GivePlayerMoney(playerid,fee-PlayerInfo[giveplayerid][pBounty]);
Re: Need little help about this -
GTLS - 27.10.2018
Why create a whole new variable when you just do as Y-Less said lol. fee is just a waste of variable. Just use your common sense, if you want to subtract 25%, there are many ways,
One that you're using
One that Y-Less said
other being,
Код:
money = money - (money*25/100) //OR
money = money - (money/4); //OR
money = money*0.75;
EDIT:
you can also add,
List can go on.
Re: Need little help about this -
GTLS - 28.10.2018
Quote:
Originally Posted by ******
Be warned that several of those will not work for integers, only floats, so it depends on your data's type.
|
Yup sorry I forgot to mention this. You have to floatround it as they might produce floating variables.
Re: Need little help about this -
DarknesS1988 - 28.10.2018
Quote:
Originally Posted by GTLS
Yup sorry I forgot to mention this. You have to floatround it as they might produce floating variables.
|
Quote:
Originally Posted by ******
Be warned that several of those will not work for integers, only floats, so it depends on your data's type.
|
Guys, it's SOLVED, no need to find another ways of doing...iam not good in scripting like you guys because i'm still learning
Re: Need little help about this -
DarknesS1988 - 28.10.2018
Quote:
Originally Posted by ******
If you are still learning then surely seeing multiple ways of doing the same thing is useful...
|
Totally agree!