Need little help about this
#1

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(stringsizeof(string), "Your $%d Hit Fee Has Been Returned, Minus A 25 Percent Processing Fee.",PlayerInfo[giveplayerid][pBounty]);
    
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring); 
-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.
Reply
#2

You find the amount and subtract it from original value.

fee = money * 25 / 100
money = money - fee
Reply
#3

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

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]); 
Reply
#5

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,
Код:
 money = money*3/4;
List can go on.
Reply
#6

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

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

Quote:
Originally Posted by ******
Посмотреть сообщение
If you are still learning then surely seeing multiple ways of doing the same thing is useful...
Totally agree!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)