Equasion problem: - 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: Equasion problem: (
/showthread.php?tid=376173)
Equasion problem: -
Penki4a - 09.09.2012
I was making my paycheck calculations and i have the following question:
pawn Код:
if(PlayerInfo[i][pVIP] == 2) {finalpaycheck = finalpaycheck * (125/100);}//doesn't work
if(PlayerInfo[i][pVIP] == 3) {finalpaycheck = finalpaycheck * (150/100);}//doesn't work
if(PlayerInfo[i][pVIP] == 4) {finalpaycheck = finalpaycheck * (200/100);}//this equasion works but the upper two don't?
So why is the bottom equasion which is supposed to double the player's paycheck works and the upper two which are supposed to give as it follows a 50% bonus and a 25% bonus don't work?
Re: Equasion problem: -
detter - 09.09.2012
is your finalpaycheck float ?
Re: Equasion problem: -
Penki4a - 09.09.2012
No:
pawn Код:
new paycheck = ((PlayerInfo[i][pMinutes]*PlayerInfo[i][pMinutes]) / 12) * PlayerInfo[i][pLevel];
new taxamount = (TaxPercent * paycheck) / 100;
new finalpaycheck = paycheck - taxamount;
Re: Equasion problem: -
detter - 09.09.2012
make it float then try
Re: Equasion problem: -
Penki4a - 09.09.2012
Quote:
Originally Posted by detter
make it float then try
|
When i make it a float it bugs the paycheck equasion and the paycheck gets to like 10Mills
Re: Equasion problem: -
clarencecuzz - 09.09.2012
Try:
pawn Код:
if(PlayerInfo[i][pVIP] == 2) {finalpaycheck = finalpaycheck * (125/100);}//doesn't work
else if(PlayerInfo[i][pVIP] == 3) {finalpaycheck = finalpaycheck * (150/100);}//doesn't work
else if(PlayerInfo[i][pVIP] == 4) {finalpaycheck = finalpaycheck * (200/100);}//this equasion works but the upper two don't?
Re: Equasion problem: -
[MM]RoXoR[FS] - 09.09.2012
Make finalcheck Float
pawn Код:
new Float:finalpaycheck;
if(PlayerInfo[i][pVIP] == 2) {finalpaycheck = finalpaycheck * (Float:125/Float:100);}
else if(PlayerInfo[i][pVIP] == 3) {finalpaycheck = finalpaycheck * (Float:150/Float:100);}
else if(PlayerInfo[i][pVIP] == 4) {finalpaycheck = finalpaycheck * (Float:200/Float:100);}
Re: Equasion problem: -
Penki4a - 09.09.2012
Quote:
Originally Posted by clarencecuzz
Try:
pawn Код:
if(PlayerInfo[i][pVIP] == 2) {finalpaycheck = finalpaycheck * (125/100);}//doesn't work else if(PlayerInfo[i][pVIP] == 3) {finalpaycheck = finalpaycheck * (150/100);}//doesn't work else if(PlayerInfo[i][pVIP] == 4) {finalpaycheck = finalpaycheck * (200/100);}//this equasion works but the upper two don't?
|
Already did still doesn't work :S
Re: Equasion problem: -
Penki4a - 09.09.2012
Quote:
Originally Posted by [MM]RoXoR[FS]
Make finalcheck Float
pawn Код:
new Float:finalpaycheck; if(PlayerInfo[i][pVIP] == 2) {finalpaycheck = finalpaycheck * (Float:125/Float:100);} else if(PlayerInfo[i][pVIP] == 3) {finalpaycheck = finalpaycheck * (Float:150/Float:100);} else if(PlayerInfo[i][pVIP] == 4) {finalpaycheck = finalpaycheck * (Float:200/Float:100);}
|
Makes the paycheck 11M
Re: Equasion problem: -
Penki4a - 09.09.2012
i think it's from the symbol * because when i use / or + or - everything works fine