SA-MP Forums Archive
Health in cash bar - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Health in cash bar (/showthread.php?tid=138652)



Health in cash bar - Czesuaf - 02.04.2010

How can i make that health is showing in the cash bar like in WorldCup mode?

example:
got 58 hp, -58 dollars
got 12 hp, -12 dollars
got 100hp, -100 dollars

Is there a filterscript for this or should I do it by myself? ;f


Re: Health in cash bar - ScottCFR - 02.04.2010

Код:
public OnPlayerUpdate(playerid)
{
     new HP = GetPlayerMoney(playerid);
     GetPlayerMoney(playerid)
     {
        SetPlayerHealth(playerid, HP);
     }
}
Something like this i'm guessing

*Untested


Re: Health in cash bar - Czesuaf - 02.04.2010

It doesnt work


Re: Health in cash bar - MPKaboose - 02.04.2010

Quote:
Originally Posted by ScottCFR
Код:
public OnPlayerUpdate(playerid)
{
     new HP = GetPlayerMoney(playerid);
     GetPlayerMoney(playerid)
     {
        SetPlayerHealth(playerid, HP);
     }
}
Something like this i'm guessing

*Untested
why you use
pawn Код:
GetPlayerMoney(playerid);
twice and health is a float money is a variable <- that aint really important since it worked for me


Re: Health in cash bar - Czesuaf - 02.04.2010

So, anyone knows how to do it?


Re: Health in cash bar - westre - 02.04.2010

pawn Код:
new Float:hp = GetPlayerHealth(playerid, hp);
SetPlayerMoney(playerid, hp);



Re: Health in cash bar - Czesuaf - 02.04.2010

I was making the same but
Код:
C:\Documents and Settings\xxxx\xxx\x\xxx\xxx\xxx.pwn(385) : error 017: undefined symbol "SetPlayerMoney"



Re: Health in cash bar - westre - 02.04.2010

Quote:
Originally Posted by Finn
pawn Код:
#define SetPlayerMoney(%0,%1) \
  GivePlayerMoney(%0, (%1 - GetPlayerMoney(%0)))



Re: Health in cash bar - Czesuaf - 03.04.2010

it doesn't work ;/
It's changing the cash that after 10 seconds i've got about 303030$ -.-


Re: Health in cash bar - bajskorv123 - 03.04.2010

This will set your health to the amount of money you have.
pawn Код:
public OnPlayerUpdate(playerid)
{
  new Money = GetPlayerMoney(playerid);
  SetPlayerHealth(playerid, Money);
}
This will set your money to the amount of health you have.
pawn Код:
public OnPlayerUpdate(playerid)
{
  new Float:Health = GetPlayerHealth(playerid);
  SetPlayerMoney(playerid, Health);
}

//Somewhere in script
stock SetPlayerMoney(playerid, money)
{
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, money);
}