Jump to content
  • 0

Nu se actualizează hudul


newbie.

Question

Problema intalnita (descriere): Am făcut să apară viața la jucător și nu se actualizează, de exemplu eu am viața 100, activez hudu să apară viața, dă unu în mine, îmi scade viața dar la hud apare că tot am 100.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): 

		case DIALOG_HUD4:
		{
			if(!response)
			{
				hidePlayerDialog(playerid);
			}
			else
			{
				switch(listitem)
				{
					case 0:
					{
						new Float: hp;
						GetPlayerHealth(playerid, hp);
						format(szMessage, sizeof(szMessage), "~B~~w~%.0f", hp);
						TextDrawSetString(HealthTD[playerid], szMessage);
						TextDrawShowForPlayer(playerid, HealthTD[playerid]);
						SendClientMessage(playerid, COLOR_SETLEADER, "Hud options successfully changed.");
					}
					case 1:
					{
						new Float: hp;
						GetPlayerHealth(playerid, hp);
						format(szMessage, sizeof(szMessage), "~B~%.0f", hp);
						TextDrawSetString(HealthTD[playerid], szMessage);
						TextDrawShowForPlayer(playerid, HealthTD[playerid]);
						SendClientMessage(playerid, COLOR_SETLEADER, "Hud options successfully changed.");
					}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: da, am încercat să fac într-un timer dar tot nu merge

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Daca vrei ajutor, sa iti pot corecta scriptul.

La inceputul scriptului pui:

new Text:Health[MAX_PLAYERS];

La OnGamemodeInit:

for(new i = 0; i < MAX_PLAYERS; i++)
	{
	Health[i] = TextDrawCreate(blablabla)
	//continui tu cu textdraw-ul..
	
	}

La OnPlayerSpawn:

TextDrawShowForPlayer(playerid, Health[playerid]);

La sfarsitul scriptului:

forward viata(playerid);
public viata(playerid)
{
new string[5], Float:pHealth;
GetPlayerHealth(playerid,pHealth);
format(string, sizeof(string), "%.0f%", pHealth);
TextDrawSetString(Health[playerid], string);
}

Si adaugi la OnPlayerUpdate acest timer:

SetTimer("viata",1000,1);

P.S: Nu mai fi asa guraliv, atat timp cat ai nevoie de ajutor, macar vorbeste si tu mai ok. Daca postai textdraw-ul it dadeam mura in gura tot. Romanul tot roman e.

  • Upvote 1
Link to comment
Share on other sites

  • 0

Prietene,daca doresti sa te ajutam da te rog acel textdraw,sa iti spun si de ce?

Fiindca s-ar putea sa ai TextDrawCreate(bla bla bla "100");

De aia.Posteaza te rog sa vedem.

  • Upvote 1

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.