Originally Posted by [BOPE]Seu._.Madruga
Pronto arrumei o cуdigo e jб arrumei outra parada.
Ajudei? +Rep
° Se for filterscript:
PHP код:
public OnFilterScriptInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
MostrarVida[i] = TextDrawCreate(370.000000,396.000000," ");
TextDrawTextSize(MostrarVida[i],645.000000,1.000000);
TextDrawAlignment(MostrarVida[i],0);
TextDrawFont(MostrarVida[i],3);
TextDrawLetterSize(MostrarVida[i],0.490000,1.130000);
TextDrawColor(MostrarVida[i],0xffffffff);
TextDrawSetOutline(MostrarVida[i],1);
TextDrawSetProportional(MostrarVida[i],1);
TextDrawSetShadow(MostrarVida[i],1);
}
return 1;
}
° Se for direto no Gamemode:
PHP код:
public OnGameModeInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
MostrarVida[i] = TextDrawCreate(370.000000,396.000000," ");
TextDrawTextSize(MostrarVida[i],645.000000,1.000000);
TextDrawAlignment(MostrarVida[i],0);
TextDrawFont(MostrarVida[i],3);
TextDrawLetterSize(MostrarVida[i],0.490000,1.130000);
TextDrawColor(MostrarVida[i],0xffffffff);
TextDrawSetOutline(MostrarVida[i],1);
TextDrawSetProportional(MostrarVida[i],1);
TextDrawSetShadow(MostrarVida[i],1);
}
return 1;
}
° Cуdigo completo:
PHP код:
//#define FILTERSCRIPT
#include <a_samp>
new TempoMostrarLife[MAX_PLAYERS];
new MostrandoVida[MAX_PLAYERS];
new Text:MostrarVida[MAX_PLAYERS];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
MostrarVida[i] = TextDrawCreate(370.000000,396.000000," ");
TextDrawTextSize(MostrarVida[i],645.000000,1.000000);
TextDrawAlignment(MostrarVida[i],0);
TextDrawFont(MostrarVida[i],3);
TextDrawLetterSize(MostrarVida[i],0.490000,1.130000);
TextDrawColor(MostrarVida[i],0xffffffff);
TextDrawSetOutline(MostrarVida[i],1);
TextDrawSetProportional(MostrarVida[i],1);
TextDrawSetShadow(MostrarVida[i],1);
}
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(IsPlayerConnected(playerid))
{
new str[256], aname[MAX_PLAYER_NAME];
PlayerPlaySound(playerid, 1095, 0.0, 0.0, 0.0);
PlayerPlaySound(issuerid, 6401, 0.0, 0.0, 0.0);
//===================[ playerid ]==================================
new Float:health;
GetPlayerHealth(playerid, health);
if(issuerid == INVALID_PLAYER_ID)
{
KillTimer(TempoMostrarLife[playerid]);
TextDrawShowForPlayer(playerid, MostrarVida[playerid]);
format(str,sizeof(str),"~y~Vida:~r~ -%.1f", amount);
TextDrawSetString(MostrarVida[playerid], str);
TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", playerid);
MostrandoVida[playerid] = 1;
}
else
{
KillTimer(TempoMostrarLife[playerid]);
TextDrawShowForPlayer(playerid, MostrarVida[playerid]);
GetPlayerName(issuerid, aname,sizeof(aname));
format(str,sizeof(str),"~y~%s ~n~~w~tirou: ~r~-%.1f", aname, amount);
TextDrawSetString(MostrarVida[playerid], str);
TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", playerid);
MostrandoVida[playerid] = 1;
}
//==================[ issuerid ] ======================================
KillTimer(TempoMostrarLife[issuerid]);
TextDrawShowForPlayer(issuerid, MostrarVida[issuerid]);
GetPlayerName(playerid, aname,sizeof(aname));
format(str,sizeof(str),"~y~%s:~g~ -%.1f",aname, amount);
TextDrawSetString(MostrarVida[issuerid], str);
TempoMostrarLife[issuerid] = SetTimerEx("HideTextoLife", 3000, 0, "i", issuerid);
MostrandoVida[issuerid] = 1;
}
return true;
}
forward HideTextoLife(playerid);
public HideTextoLife(playerid)
{
if(MostrandoVida[playerid] == 1)
{
TextDrawHideForPlayer(playerid, MostrarVida[playerid]);
MostrandoVida[playerid] = 0;
}
return true;
}
|