Updating Textdraw
#1

Can you help me give a sample demo of updating textdraw? for example.

I made a scoring text textdraw.

0/100

When I kill 1 enemey the 0 score will turn to 1.

thank you
Reply
#2

Can you show us your textdraw ?
Reply
#3

Quote:
Originally Posted by samp_boy
Посмотреть сообщение
Can you show us your textdraw ?
Here. and Im using zamaroth textdraw editor ingame.

This is the Text for 0

Код:
// On top of script:
new Text:Textdraw0;

// In OnGameModeInit prefferably, we procced to create our textdraws:
Textdraw0 = TextDrawCreate(311.000000, 348.000000, "0");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.800000);
TextDrawColor(Textdraw0, -65281);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
Reply
#4

Little HELP

Код:
public OnPlayerUpdate(playerid)
{
	new string[256];
	format(string,sizeof(string),"~w~%d",GetPlayerScore(playerid));
	TextDrawSetString(Textdraw0[playerid],string);
	TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
	return 1;
}
Error line

TextDrawSetString(Textdraw0[playerid],string);

Код:
error 028: invalid subscript (not an array or too many subscripts): "Textdraw0"
 warning 215: expression has no effect
 error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
 fatal error 107: too many error messages on one line
Reply
#5

pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[256];
    format(string,sizeof(string),"~w~%d",GetPlayerScore(playerid));
    TextDrawSetString(Textdraw0,string);
    TextDrawShowForPlayer(playerid,Textdraw0);
    return 1;
}
Reply
#6

pawn Код:
// On top of script:
new Text:Textdraw0[MAX_PLAYERS];

// In OnGameModeInit prefferably, we procced to create our textdraws:
for(new i; i < MAX_PLAYERS; i++)
{
Textdraw0[i] = TextDrawCreate(311.000000, 348.000000, "0");
TextDrawBackgroundColor(Textdraw0[i], 255);
TextDrawFont(Textdraw0[i], 1);
TextDrawLetterSize(Textdraw0[i], 0.500000, 1.800000);
TextDrawColor(Textdraw0[i], -65281);
TextDrawSetOutline(Textdraw0[i], 0);
TextDrawSetProportional(Textdraw0[i], 1);
TextDrawSetShadow(Textdraw0[i], 1);
}
pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[256];
    format(string,sizeof(string),"~w~%d",GetPlayerScore(playerid));
    TextDrawSetString(Textdraw0[playerid],string);
    TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
    return 1;
}
Reply
#7

Quote:
Originally Posted by Macronix
Посмотреть сообщение
pawn Код:
// On top of script:
new Text:Textdraw0[MAX_PLAYERS];

// In OnGameModeInit prefferably, we procced to create our textdraws:
for(new i; i < MAX_PLAYERS; i++)
{
Textdraw0[i] = TextDrawCreate(311.000000, 348.000000, "0");
TextDrawBackgroundColor(Textdraw0[i], 255);
TextDrawFont(Textdraw0[i], 1);
TextDrawLetterSize(Textdraw0[i], 0.500000, 1.800000);
TextDrawColor(Textdraw0[i], -65281);
TextDrawSetOutline(Textdraw0[i], 0);
TextDrawSetProportional(Textdraw0[i], 1);
TextDrawSetShadow(Textdraw0[i], 1);
}
pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[256];
    format(string,sizeof(string),"~w~%d",GetPlayerScore(playerid));
    TextDrawSetString(Textdraw0[playerid],string);
    TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
    return 1;
}
That will work but is the wrong way to do it, he needs player textdraws.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)