Hello. It's hard to write, because I haven't been here for a while. After I was infected I became a zombie, but I don't drink human's blood, I like orange juice mo'. So, I'll visit you once a month or more, cuz people say that's better to learn programming languages when you are young. I'd like to share my healing system. Yeah lol, but money amount to pay depends from hp u need, that's for nerdos who's gonna break their display for paying $100000 to take 1hp. I hope Aled won't call this script a bull shit, and:
[pawn]stock SellPlayerHealth(playerid)
{
new Float:phealth, Float:product1, Float:product2;
new pmoney = GetPlayerMoney(playerid);
new money2pay[256];
GetPlayerHealth(playerid, phealth);
if(phealth <= 99)
{
product1 = floatsub(100, phealth);
product2 = floatmul(product1, 5);//My price for 1hp is $5, change "5" on your integer if you want
format(money2pay, sizeof(money2pay), "%0.2f", product2);
new money2payfinal = strval(money2pay);
if(money2payfinal <= pmoney)
{
SetPlayerHealth(playerid, 100);
SetPlayerMoney(playerid, pmoney - money2payfinal);
new string2[256];
format(string2, sizeof(string2), "You have been healed for $%d", money2payfinal);
SendClientMessage(playerid, 0xFFFFFFAA, string2);
}
else
{
new string3[256];
format(string3, sizeof(string3), "You don't have enough money (you need $%d)", money2payfinal);
SendClientMessage(playerid, 0xFF0000AA, string3);
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You don't need to heal yourself");
}
}[/pawn]