#1

i've made a score textdraw that appears top of the screen but its not working :S

Onplayerspawn :
Код:
public OnPlayerSpawn(playerid)
{
  if(gTeam[playerid] == TEAM_LS)
  	{
  		SetPlayerColor(playerid,COLOR_GREEN);
  	}
  	else
  	{
  	if(gTeam[playerid] == TEAM_LV)
  	{
  		SetPlayerColor(playerid,COLOR_YELLOW);
  	}
  }
  return 1;
}
Onplayerrequestclass :

Код:
public OnPlayerRequestClass(playerid, classid)
{
  iSpawnSet[playerid] = 0;
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
 	SetPlayerCameraPos(playerid, 1961.1343,1342.7173,15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	SetupPlayerForClassSelection(playerid);
	switch (classid)
	{
		case 0:
		{
			GameTextForPlayer(playerid, "~g~Los Santos", 1000, 3);
			SetPlayerColor(playerid,COLOR_GREEN);
			gTeam[playerid] = TEAM_LS;
		}
		case 1:
		{
			GameTextForPlayer(playerid, "~Y~Las Venturas", 1000, 3);
			SetPlayerColor(playerid,COLOR_YELLOW);
			gTeam[playerid] = TEAM_LV;
		}
}
return 1;
}
Ongamemodeinit (the textdraw part) :

Код:
Textdraw2 = TextDrawCreate(394.000000,1.000000,"LS:[%s]|| LV:[%s]");
    new string[128];
	format(string, sizeof(string), "LS: %d || LV: %d", lsscore, lvscore);
	TextDrawSetString(Textdraw2, string);
    TextDrawShowForAll(Textdraw2);
	TextDrawAlignment(Textdraw2,0);
	TextDrawBackgroundColor(Textdraw2,0x0000ffcc);
 	TextDrawFont(Textdraw2,3);
	TextDrawLetterSize(Textdraw2,0.399999,1.100000);
	TextDrawColor(Textdraw2,0xffffffff);
	TextDrawSetOutline(Textdraw2,1);
	TextDrawSetProportional(Textdraw2,1);
	TextDrawSetShadow(Textdraw2,1);
can anyone help me?
Reply
#2

pawn Код:
//OnPlayerSpawn:
ShowTextDrawForPlayer(playerid, Textdraw2);
//OnPlayerDeath:
HideTextDrawForPlayer(playerid, Textdraw2);
But in this case you have to update the textdraw everytime you change it:

pawn Код:
//OnGameModeInit:
Textdraw2 = TextDrawCreate(394.0, 1.0, "LS:[0] || LV:[0]");
TextDrawAlignment(Textdraw2, 0);
TextDrawBackgroundColor(Textdraw2, 0x0000FFCC);
TextDrawFont(Textdraw2, 3);
TextDrawLetterSize(Textdraw2, 0.399999, 1.1);
TextDrawColor(Textdraw2, 0xFFFFFFFF);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
TextDrawSetShadow(Textdraw2, 1);

//when the scores are changed
new string[128];
format(string, sizeof(string), "LS: %d || LV: %d", lsscore, lvscore);
TextDrawSetString(Textdraw2, string);
Reply
#3

undefined symboles : undefined symbol "ShowTextdrawForPlayer"
undefined symbol "HideTextdrawForPlayer"
Reply
#4

Try this:
pawn Код:
TextDrawShowForPlayer(playerid,TextDraw2);
TextDrawHideForPlayer(playerid,TextDraw2);
Reply
#5

didnt work , Text draw freeze on : LS : 0 || LV : 0
Reply
#6

Try:

OnGameModeInit/OnFilterScriptInit:
pawn Код:
SetTimer("UpdateTextDraw", 1000, true);
pawn Код:
public UpdateTextDraw()
{
new string[128];
format(string, sizeof(string), "LS: %d || LV: %d", lsscore, lvscore);
TextDrawSetString(Textdraw2, string);
return 1;
}
Reply
#7

now textdraw doesnt showup and when compiling it said : warning 235: public function lacks forward declaration (symbol "UpdateTextDraw")


line : public UpdateTextDraw()
Reply
#8

Put in top of your script:
pawn Код:
forward UpdateTextDraw();
Reply
#9

still doesnt show
Reply
#10

You has put "TextDrawShowForPlayer(playerid,TextDraw2);"?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)