Tem como colocar a parte cinza em cima do verde
naum sei se e isso mais tai
// Setup
#include <a_samp>
new CurCol[MAX_PLAYERS] = 0;
new Conn[MAX_PLAYERS] = 0;
new Money[MAX_PLAYERS] = 0;
new Text:MoneyTxt[MAX_PLAYERS];
// You can change the color in the define's below.
#define COLOR_GreenMoney 0xC0C0C0AA
#define COLOR_YellowMoney 0xC0C0C0AA
#define COLOR_RedMoney 0xC0C0C0AA
#define COLOR_GreyMoney 0xC0C0C0AA
/*
Was going to do some things with boxes but it got a little buggy so I commented out the boxes.
Theese defines were some colors to use for the boxes. Don't worry about them.
#define COLOR_GreenBox 0x00ff00cc
#define COLOR_YellowBox 0xffff00cc
#define COLOR_RedBox 0xff0000cc
#define COLOR_GreyBox 0xC0C0C0cc
*/
// Main
public OnPlayerUpdate(playerid)
{
if(Conn[playerid] == 1 && CurCol[playerid] != 0)
{
if(GetPlayerMoney(playerid) != Money[playerid] && GetPlayerMoney(playerid) != 0)
{
new string[13];
if(GetPlayerMoney(playerid) > 0 && GetPlayerMoney(playerid) <= 999999999)
{
if(GetPlayerMoney(playerid) < 10)
{
format(string, sizeof(string), "$0000000%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 99)
{
format(string, sizeof(string), "$000000%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 999)
{
format(string, sizeof(string), "$00000%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 9999)
{
format(string, sizeof(string), "$0000%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 99999)
{
format(string, sizeof(string), "$000%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 999999)
{
format(string, sizeof(string), "$00%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 9999999)
{
format(string, sizeof(string), "$0%i", GetPlayerMoney(playerid));
}
else if(GetPlayerMoney(playerid) <= 99999999)
{
format(string, sizeof(string), "$%i", GetPlayerMoney(playerid));
}
}
else if(GetPlayerMoney(playerid) < 0 && GetPlayerMoney(playerid) >= -999999999)
{
new TheNewMoney = GetPlayerMoney(playerid) * -1;
if(GetPlayerMoney(playerid) > -10)
{
format(string, sizeof(string), "$0000000%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -99)
{
format(string, sizeof(string), "$000000%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -999)
{
format(string, sizeof(string), "$00000%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -9999)
{
format(string, sizeof(string), "$0000%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -99999)
{
format(string, sizeof(string), "$000%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -999999)
{
format(string, sizeof(string), "$00%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -9999999)
{
format(string, sizeof(string), "$0%i", TheNewMoney);
}
else if(GetPlayerMoney(playerid) >= -99999999)
{
format(string, sizeof(string), "$%i", TheNewMoney);
}
}
TextDrawSetString(MoneyTxt[playerid], string);
}
if(CurCol[playerid] != 1 && GetPlayerMoney(playerid) >= 20000) // You can change the default >= and 20000 to whatever you wish. This means if they have 20000 or greater cash their money will be the color green.
{
CurCol[playerid] = 1;
TextDrawHideForPlayer(playerid,MoneyTxt[playerid]);
//TextDrawBoxColor(MoneyTxt[playerid],COLOR_GreenBox);
TextDrawColor(MoneyTxt[playerid],COLOR_GreenMoney);
TextDrawShowForPlayer(playerid,MoneyTxt[playerid]);
}
else if(CurCol[playerid] != 3 && GetPlayerMoney(playerid) < 0) // You can change the default < and 0 to whatever you wish. This means if they have less than 0 cash (negative cash) their money will be the color red.
{
CurCol[playerid] = 3;
TextDrawHideForPlayer(playerid,MoneyTxt[playerid]);
//TextDrawBoxColor(MoneyTxt[playerid],COLOR_RedBox);
TextDrawColor(MoneyTxt[playerid],COLOR_RedMoney);
TextDrawShowForPlayer(playerid,MoneyTxt[playerid]);
}
else if(CurCol[playerid] != 2 && GetPlayerMoney(playerid) < 20000 && GetPlayerMoney(playerid) > 0) // You can change the default < and 20000 to whatever you wish. This means if they have less than 20000 cash their money will be the color yellow.
{
CurCol[playerid] = 2;
TextDrawHideForPlayer(playerid,MoneyTxt[playerid]);
//TextDrawBoxColor(MoneyTxt[playerid],COLOR_YellowBox);
TextDrawColor(MoneyTxt[playerid],COLOR_YellowMoney);
TextDrawShowForPlayer(playerid,MoneyTxt[playerid]);
}
if(CurCol[playerid] != 4 && GetPlayerMoney(playerid) == 0)
{
CurCol[playerid] = 4;
TextDrawHideForPlayer(playerid,MoneyTxt[playerid]);
//TextDrawBoxColor(MoneyTxt[playerid],COLOR_GreyBox);
TextDrawColor(MoneyTxt[playerid],COLOR_GreyMoney);
TextDrawShowForPlayer(playerid,MoneyTxt[playerid]);
TextDrawSetString(MoneyTxt[playerid], "$00000000");
}
}
return 0;
}
public OnPlayerConnect(playerid)
{
Conn[playerid] = 2;
CurCol[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(Conn[playerid] == 2)
{
MoneyTxt[playerid] = TextDrawCreate(498.000000,73.000000,"$00000000");
TextDrawAlignment(MoneyTxt[playerid],0);
TextDrawBackgroundColor(MoneyTxt[playerid],0x000000ff);
TextDrawFont(MoneyTxt[playerid],3);
TextDrawLetterSize(MoneyTxt[playerid],0.599999,2.899999);
TextDrawColor(MoneyTxt[playerid],COLOR_GreenMoney);
//TextDrawUseBox(MoneyTxt[playerid],1);
//TextDrawBoxColor(MoneyTxt[playerid],COLOR_GreenBox);
TextDrawSetOutline(MoneyTxt[playerid],1);
TextDrawSetProportional(MoneyTxt[playerid],1);
TextDrawShowForPlayer(playerid, MoneyTxt[playerid]);
CurCol[playerid] = 1;
Conn[playerid] = 1;
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
TextDrawDestroy(MoneyTxt[playerid]);
Conn[playerid] = 0;
CurCol[playerid] = 0;
return 1;
}