How to insert value of GetPVarInt into a player text draw -
SlonCHL - 01.06.2013
How do I insert the value of GetPVarInt in to a player text draw, I tried this but it didn't work
pawn Код:
new PlayerCashBalance[25];
format(PlayerCashBalance, sizeof(PlayerCashBalance), "Cash: %d", GetPVarInt(playerid, "Cash"));
PlayerTextDrawSetString(playerid, CashTextDraw[playerid], PlayerCashBalance);
Re: How to insert value of GetPVarInt into a player text draw -
Konstantinos - 01.06.2013
That way is correct, I usually after editing the string, I set the string and then show to player.
AW: How to insert value of GetPVarInt into a player text draw -
Skimmer - 01.06.2013
I don't see any error there, but do you get Errors? Yes? Then post them here.
And it would be good if you give us more informations. What does it show?
Did you even used PlayerTextDrawShow()? Try printf() below PlayerTextDrawSetString() and look what comes out at console.
pawn Код:
printf("Textdrawstring: %s", PlayerCashBalance);
Re: How to insert value of GetPVarInt into a player text draw -
SlonCHL - 01.06.2013
Yeah I did use PlayerTextDrawShow(). Here's more details
My full code
pawn Код:
CashTextDraw[playerid] = CreatePlayerTextDraw(playerid, 560.0, 108.0, "Cash: 0");
PlayerTextDrawSetShadow(playerid, CashTextDraw[playerid], 1);
PlayerTextDrawAlignment(playerid, CashTextDraw[playerid], 3);
PlayerTextDrawFont(playerid, CashTextDraw[playerid], 1);
PlayerTextDrawColor(playerid, CashTextDraw[playerid], 0xFF0000AA);
PlayerTextDrawSetOutline(playerid, CashTextDraw[playerid], 1);
PlayerTextDrawShow(playerid, CashTextDraw[playerid]);
SetPVarInt(playerid, "Cash", 362528);
new PlayerCashBalance[25];
format(PlayerCashBalance, sizeof(PlayerCashBalance), "Cash: %d", GetPVarInt(playerid, "Cash"));
PlayerTextDrawSetString(playerid, CashTextDraw[playerid], PlayerCashBalance);
PlayerTextDrawShow(playerid, CashTextDraw[playerid]);
Here's the result
Here's the server log with the printf code
Код:
[22:08:02] Incoming connection: 25.23.69.146:65384
[22:08:02] [join] SlonCHL has joined the server (0:25.23.69.146)
[22:08:02] Textdrawstring: Cash: 362528
[22:09:07] [part] SlonCHL has left the server (0:1)
Re: How to insert value of GetPVarInt into a player text draw -
Konstantinos - 01.06.2013
Where have you added that part (callback)?
pawn Код:
new PlayerCashBalance[25];
format(PlayerCashBalance, sizeof(PlayerCashBalance), "Cash: %d", GetPVarInt(playerid, "Cash"));
PlayerTextDrawSetString(playerid, CashTextDraw[playerid], PlayerCashBalance);
PlayerTextDrawShow(playerid, CashTextDraw[playerid]);
Re: How to insert value of GetPVarInt into a player text draw -
SlonCHL - 01.06.2013
OnPlayerConnect but now I added a timer there
pawn Код:
CashTextDraw[playerid] = CreatePlayerTextDraw(playerid, 560.0, 100.0, "Cash: 0");
PlayerTextDrawSetShadow(playerid, CashTextDraw[playerid], 1);
PlayerTextDrawAlignment(playerid, CashTextDraw[playerid], 3);
PlayerTextDrawFont(playerid, CashTextDraw[playerid], 1);
PlayerTextDrawColor(playerid, CashTextDraw[playerid], 0xFF0000AA);
PlayerTextDrawSetOutline(playerid, CashTextDraw[playerid], 1);
PlayerTextDrawShow(playerid, CashTextDraw[playerid]);
SetPVarInt(playerid, "Cash", 362528);
SetTimerEx("UpdateCashAmount", 1500, true, "i", playerid);
pawn Код:
public UpdateCashAmount(playerid)
{
new PlayerCashBalance[25];
format(PlayerCashBalance, sizeof(PlayerCashBalance), "Cash: %d", GetPVarInt(playerid, "Cash"));
PlayerTextDrawSetString(playerid, CashTextDraw[playerid], PlayerCashBalance);
}
Re: How to insert value of GetPVarInt into a player text draw -
SlonCHL - 01.06.2013
Ok peoples, solved it. My fault