Updating Textdraw - 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)
+--- Thread: Updating Textdraw (
/showthread.php?tid=501855)
Updating Textdraw -
gotwarzone - 20.03.2014
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
Re : Updating Textdraw -
samp_boy - 20.03.2014
Can you show us your textdraw ?
Re: Re : Updating Textdraw -
gotwarzone - 20.03.2014
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);
Re: Updating Textdraw -
gotwarzone - 20.03.2014
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
Re: Updating Textdraw -
[..MonTaNa..] - 20.03.2014
pawn Код:
public OnPlayerUpdate(playerid)
{
new string[256];
format(string,sizeof(string),"~w~%d",GetPlayerScore(playerid));
TextDrawSetString(Textdraw0,string);
TextDrawShowForPlayer(playerid,Textdraw0);
return 1;
}
AW: Updating Textdraw -
Macronix - 20.03.2014
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;
}
Re: AW: Updating Textdraw -
Pottus - 21.03.2014
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.