SA-MP Forums Archive
[Ajuda] ProgressBar - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] ProgressBar (/showthread.php?tid=540990)



ProgressBar - SatanMessenger - 08.10.2014

Achei um fs de experiencia sу que nao ta mostrando o progressbar e a textdraw alguem me ajuda

Code:
/*Barra de experiencia by Ariel v1*/

#include <a_samp>
#include <progress>

new Bar:Experiencia[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
new Text:Progreso;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Fs cargado correctamente");
	print("--------------------------------------\n");
	
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
}

#endif

public OnGameModeInit()
{
    new playerid;
	for (playerid = 0; playerid < GetMaxPlayers(); playerid ++)
	{
	Experiencia[playerid] = CreateProgressBar(514.00, 437.00, 119.50, 5.19, -58369, 100.0);
	}
	
	Progreso = TextDrawCreate(525.000000, 424.000000, "Experiencia");
	TextDrawBackgroundColor(Progreso, 255);
	TextDrawFont(Progreso, 1);
	TextDrawLetterSize(Progreso, 0.500000, 1.000000);
	TextDrawColor(Progreso, 16711935);
	TextDrawSetOutline(Progreso, 1);
	TextDrawSetProportional(Progreso, 1);

	return 1;
}

public OnGameModeExit()
{
    TextDrawDestroy(Progreso);

	return 1;
}

public OnPlayerRequestSpawn(playerid)
{

    ShowProgressBarForPlayer(playerid,Experiencia[playerid]);
    TextDrawShowForPlayer(playerid,Progreso);

	return 1;
}

public OnPlayerUpdate(playerid)
{
	new Exp;
	Exp = GetPlayerScore(playerid);
	ShowProgressBarForPlayer(playerid,Experiencia[playerid]);
    SetProgressBarValue(Experiencia[playerid],Exp);
    SetProgressBarMaxValue(Experiencia[playerid],100);
    UpdateProgressBar(Experiencia[playerid],playerid);
    
    if(Exp >= 0 && Exp <= 20) SetProgressBarColor(Experiencia[playerid],0xFF0000FF);
    if(Exp >= 20 && Exp <= 40) SetProgressBarColor(Experiencia[playerid],0xEA5500FF);
    if(Exp >= 40 && Exp <= 60) SetProgressBarColor(Experiencia[playerid],0xEAE600FF);
    if(Exp >= 80 && Exp <= 100) SetProgressBarColor(Experiencia[playerid],0x00E600FF);
    
	return 1;
}



Respuesta: ProgressBar - SatanMessenger - 08.10.2014

+1 Pergunta tem que fazer salvamento?


Re: Respuesta: ProgressBar - Marlon307 - 08.10.2014

Quote:
Originally Posted by SatanMessenger
View Post
+1 Pergunta tem que fazer salvamento?
Sim.


Re: ProgressBar - [BOPE]Seu._.Madruga - 09.10.2014

Quote:
Originally Posted by SatanMessenger
View Post
Achei um fs de experiencia sу que nao ta mostrando o progressbar e a textdraw alguem me ajuda

Code:
/*Barra de experiencia by Ariel v1*/

#include <a_samp>
#include <progress>

new Bar:Experiencia[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
new Text:Progreso;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Fs cargado correctamente");
	print("--------------------------------------\n");
	
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
}

#endif

public OnGameModeInit()
{
    new playerid;
	for (playerid = 0; playerid < GetMaxPlayers(); playerid ++)
	{
	Experiencia[playerid] = CreateProgressBar(514.00, 437.00, 119.50, 5.19, -58369, 100.0);
	}
	
	Progreso = TextDrawCreate(525.000000, 424.000000, "Experiencia");
	TextDrawBackgroundColor(Progreso, 255);
	TextDrawFont(Progreso, 1);
	TextDrawLetterSize(Progreso, 0.500000, 1.000000);
	TextDrawColor(Progreso, 16711935);
	TextDrawSetOutline(Progreso, 1);
	TextDrawSetProportional(Progreso, 1);

	return 1;
}

public OnGameModeExit()
{
    TextDrawDestroy(Progreso);

	return 1;
}

public OnPlayerRequestSpawn(playerid)
{

    ShowProgressBarForPlayer(playerid,Experiencia[playerid]);
    TextDrawShowForPlayer(playerid,Progreso);

	return 1;
}

public OnPlayerUpdate(playerid)
{
	new Exp;
	Exp = GetPlayerScore(playerid);
	ShowProgressBarForPlayer(playerid,Experiencia[playerid]);
    SetProgressBarValue(Experiencia[playerid],Exp);
    SetProgressBarMaxValue(Experiencia[playerid],100);
    UpdateProgressBar(Experiencia[playerid],playerid);
    
    if(Exp >= 0 && Exp <= 20) SetProgressBarColor(Experiencia[playerid],0xFF0000FF);
    if(Exp >= 20 && Exp <= 40) SetProgressBarColor(Experiencia[playerid],0xEA5500FF);
    if(Exp >= 40 && Exp <= 60) SetProgressBarColor(Experiencia[playerid],0xEAE600FF);
    if(Exp >= 80 && Exp <= 100) SetProgressBarColor(Experiencia[playerid],0x00E600FF);
    
	return 1;
}
Vocк terб que dar uma arrumada neste cуdigo, principalmente nas textdraws.

Conselho de amigo.