new Text:CashInfo[MAX_PLAYERS];
// OnPlayerConnect
CashInfo[playerid] = TextDrawCreate(486.000000, 120.000000, "Cash: 000");
TextDrawBackgroundColor(CashInfo[playerid], 255);
TextDrawFont(CashInfo[playerid], 1);
TextDrawLetterSize(CashInfo[playerid], 0.430000, 1.500000);
TextDrawColor(CashInfo[playerid], -1);
TextDrawSetProportional(CashInfo[playerid], 1);
TextDrawSetShadow(CashInfo[playerid], 1);
//OnPlayerSpawn
TextDrawShowForPlayer(playerid, CashInfo[playerid]);
SetTimerEx("AtualizarText", 1000, true, "ui", playerid, Player[playerid][pGold]);
forward AtualizarText(playerid, gold);
public AtualizarText(playerid, gold)
{
new str[80];
format(str, sizeof(str), "Cash: %i ", gold);
TextDrawSetString(CashInfo[playerid], str);
return true;
}
forward AtualizarText(playerid, gold);
public AtualizarText(playerid, gold)
{
new str[80];
format(str, sizeof(str), "Cash: %i ", gold);
TextDrawSetString(CashInfo[playerid], str);
TextDrawShowForPlayer(playerid, CashInfo[playerid]);
return true;
}
pawn Код:
|
format(str, sizeof(str), "Cash: %i", gold);
new Text:CashInfo[MAX_PLAYERS];
new Str[128];
enum pInfo {
pGold
};
new Player[MAX_PLAYERS][pInfo];
public OnPlayerConnect(playerid) {
CashInfo[playerid] = TextDrawCreate(486.000000, 120.000000, "");
TextDrawBackgroundColor(CashInfo[playerid], 255);
TextDrawFont(CashInfo[playerid], 1);
TextDrawLetterSize(CashInfo[playerid], 0.430000, 1.500000);
TextDrawColor(CashInfo[playerid], -1);
TextDrawSetProportional(CashInfo[playerid], 1);
TextDrawSetShadow(CashInfo[playerid], 1);
return 1;
}
forward Atualizar(playerid);
public Atualizar(playerid)
{
format(Str,sizeof(Str),"Cash %d", Player[playerid][pGold]);
TextDrawSetString(CashInfo[playerid], Str);
TextDrawShowForPlayer(playerid, CashInfo[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetTimerEx("Atualizar", 1000, true, "i", playerid);
return 1;
}