[FilterScript] Sistema de Life
#1

Health Bar V1

pawn Код:
// Topo GM
new Text:SVida0[MAX_PLAYERS],Text:SVida1[MAX_PLAYERS],Text:SVida2[MAX_PLAYERS];
new Text:SVida3[MAX_PLAYERS],Text:SVida4[MAX_PLAYERS],Text:SVida5[MAX_PLAYERS];
new Text:SVida6[MAX_PLAYERS],Text:SVida7[MAX_PLAYERS],Text:SVida8[MAX_PLAYERS];
new Text:SVida9[MAX_PLAYERS],Text:SVida10[MAX_PLAYERS],Text:SVida11[MAX_PLAYERS];
new Text:SVida12[MAX_PLAYERS],Text:SVida13[MAX_PLAYERS],Text:SVida14[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{

SVida0[playerid] = TextDrawCreate(627.000000, 47.000000, "_");
TextDrawBackgroundColor(SVida0[playerid], 255);
TextDrawFont(SVida0[playerid], 1);
TextDrawLetterSize(SVida0[playerid], 1.309998, 2.899998);
TextDrawColor(SVida0[playerid], -1);
TextDrawSetOutline(SVida0[playerid], 0);
TextDrawSetProportional(SVida0[playerid], 1);
TextDrawSetShadow(SVida0[playerid], 1);
TextDrawUseBox(SVida0[playerid], 1);
TextDrawBoxColor(SVida0[playerid], 255);
TextDrawTextSize(SVida0[playerid], 539.000000, -15.000000);

SVida1[playerid] = TextDrawCreate(623.000000, 53.000000, "_");
TextDrawBackgroundColor(SVida1[playerid], 255);
TextDrawFont(SVida1[playerid], 1);
TextDrawLetterSize(SVida1[playerid], 0.439999, 1.500000);
TextDrawColor(SVida1[playerid], -1);
TextDrawSetOutline(SVida1[playerid], 0);
TextDrawSetProportional(SVida1[playerid], 1);
TextDrawSetShadow(SVida1[playerid], 1);
TextDrawUseBox(SVida1[playerid], 1);
TextDrawBoxColor(SVida1[playerid], -1953793281);
TextDrawTextSize(SVida1[playerid], 541.000000, -10.000000);

SVida2[playerid] = TextDrawCreate(541.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida2[playerid], -16776961);
TextDrawFont(SVida2[playerid], 1);
TextDrawLetterSize(SVida2[playerid], 1.070000, 2.599999);
TextDrawColor(SVida2[playerid], -16776961);
TextDrawSetOutline(SVida2[playerid], 1);
TextDrawSetProportional(SVida2[playerid], 1);

SVida3[playerid] = TextDrawCreate(548.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida3[playerid], -12254977);
TextDrawFont(SVida3[playerid], 1);
TextDrawLetterSize(SVida3[playerid], 1.070000, 2.599999);
TextDrawColor(SVida3[playerid], -12254977);
TextDrawSetOutline(SVida3[playerid], 1);
TextDrawSetProportional(SVida3[playerid], 1);

SVida4[playerid] = TextDrawCreate(555.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida4[playerid], -5963521);
TextDrawFont(SVida4[playerid], 1);
TextDrawLetterSize(SVida4[playerid], 1.070000, 2.599999);
TextDrawColor(SVida4[playerid], -5963521);
TextDrawSetOutline(SVida4[playerid], 1);
TextDrawSetProportional(SVida4[playerid], 1);

SVida5[playerid] = TextDrawCreate(562.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida5[playerid], -5963521);
TextDrawFont(SVida5[playerid], 1);
TextDrawLetterSize(SVida5[playerid], 1.070000, 2.599999);
TextDrawColor(SVida5[playerid], -5963521);
TextDrawSetOutline(SVida5[playerid], 1);
TextDrawSetProportional(SVida5[playerid], 1);

SVida6[playerid] = TextDrawCreate(569.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida6[playerid], -65281);
TextDrawFont(SVida6[playerid], 1);
TextDrawLetterSize(SVida6[playerid], 1.070000, 2.599999);
TextDrawColor(SVida6[playerid], -65281);
TextDrawSetOutline(SVida6[playerid], 1);
TextDrawSetProportional(SVida6[playerid], 1);

SVida7[playerid] = TextDrawCreate(576.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida7[playerid], -65281);
TextDrawFont(SVida7[playerid], 1);
TextDrawLetterSize(SVida7[playerid], 1.070000, 2.599999);
TextDrawColor(SVida7[playerid], -65281);
TextDrawSetOutline(SVida7[playerid], 1);
TextDrawSetProportional(SVida7[playerid], 1);

SVida8[playerid] = TextDrawCreate(583.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida8[playerid], -1375784961);
TextDrawFont(SVida8[playerid], 1);
TextDrawLetterSize(SVida8[playerid], 1.070000, 2.599999);
TextDrawColor(SVida8[playerid], -1375784961);
TextDrawSetOutline(SVida8[playerid], 1);
TextDrawSetProportional(SVida8[playerid], 1);

SVida9[playerid] = TextDrawCreate(590.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida9[playerid], 2147418367);
TextDrawFont(SVida9[playerid], 1);
TextDrawLetterSize(SVida9[playerid], 1.070000, 2.599999);
TextDrawColor(SVida9[playerid], 2147418367);
TextDrawSetOutline(SVida9[playerid], 1);
TextDrawSetProportional(SVida9[playerid], 1);

SVida10[playerid] = TextDrawCreate(597.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida10[playerid], 2096890111);
TextDrawFont(SVida10[playerid], 1);
TextDrawLetterSize(SVida10[playerid], 1.070000, 2.599999);
TextDrawColor(SVida10[playerid], 2096890111);
TextDrawSetOutline(SVida10[playerid], 1);
TextDrawSetProportional(SVida10[playerid], 1);

SVida11[playerid] = TextDrawCreate(604.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida11[playerid], 16711935);
TextDrawFont(SVida11[playerid], 1);
TextDrawLetterSize(SVida11[playerid], 1.070000, 2.599999);
TextDrawColor(SVida11[playerid], 16711935);
TextDrawSetOutline(SVida11[playerid], 1);
TextDrawSetProportional(SVida11[playerid], 1);

SVida12[playerid] = TextDrawCreate(652.000000, 47.000000, "_");
TextDrawBackgroundColor(SVida12[playerid], 255);
TextDrawFont(SVida12[playerid], 1);
TextDrawLetterSize(SVida12[playerid], 0.500000, 2.899998);
TextDrawColor(SVida12[playerid], -1);
TextDrawSetOutline(SVida12[playerid], 0);
TextDrawSetProportional(SVida12[playerid], 1);
TextDrawSetShadow(SVida12[playerid], 1);
TextDrawUseBox(SVida12[playerid], 1);
TextDrawBoxColor(SVida12[playerid], 255);
TextDrawTextSize(SVida12[playerid], 623.000000, 0.000000);

SVida13[playerid] = TextDrawCreate(610.000000, 47.000000, "I");
TextDrawBackgroundColor(SVida13[playerid], 16711935);
TextDrawFont(SVida13[playerid], 1);
TextDrawLetterSize(SVida13[playerid], 1.070000, 2.599998);
TextDrawColor(SVida13[playerid], 852308735);
TextDrawSetOutline(SVida13[playerid], 1);
TextDrawSetProportional(SVida13[playerid], 1);

SVida14[playerid] = TextDrawCreate(623.000000, 51.000000, "hud:radar_girlfriend");
TextDrawBackgroundColor(SVida14[playerid], 255);
TextDrawFont(SVida14[playerid], 4);
TextDrawLetterSize(SVida14[playerid], 0.500000, 1.000000);
TextDrawColor(SVida14[playerid], -1);
TextDrawSetOutline(SVida14[playerid], 0);
TextDrawSetProportional(SVida14[playerid], 1);
TextDrawSetShadow(SVida14[playerid], 1);
TextDrawUseBox(SVida14[playerid], 1);
TextDrawBoxColor(SVida14[playerid], 255);
TextDrawTextSize(SVida14[playerid], 16.000000, 16.000000);

if(pLogado[playerid] == 1)
{
TextDrawShowForPlayer(playerid, SVida0[playerid]);
TextDrawShowForPlayer(playerid, SVida1[playerid]);
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida3[playerid]);
TextDrawShowForPlayer(playerid, SVida4[playerid]);
TextDrawShowForPlayer(playerid, SVida5[playerid]);
TextDrawShowForPlayer(playerid, SVida6[playerid]);
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida9[playerid]);
TextDrawShowForPlayer(playerid, SVida10[playerid]);
TextDrawShowForPlayer(playerid, SVida11[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);
TextDrawShowForPlayer(playerid, SVida13[playerid]);
TextDrawShowForPlayer(playerid, SVida14[playerid]);
}
public OnPlayerUpdate(playerid)
{
new Float:SVidaV;
new Float:SVidaC;
GetPlayerHealth(playerid,SVidaV);
GetPlayerArmour(playerid,SVidaC);

if(SVidaV <=100)
{
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida3[playerid]);
TextDrawShowForPlayer(playerid, SVida4[playerid]);
TextDrawShowForPlayer(playerid, SVida5[playerid]);
TextDrawShowForPlayer(playerid, SVida6[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaV <=80)
{
TextDrawHideForPlayer(playerid, SVida6[playerid]);    // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida3[playerid]);
TextDrawShowForPlayer(playerid, SVida4[playerid]);
TextDrawShowForPlayer(playerid, SVida5[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaV <= 60)
{
TextDrawHideForPlayer(playerid, SVida6[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida5[playerid]);    // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida3[playerid]);
TextDrawShowForPlayer(playerid, SVida4[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaV <= 40)
{
TextDrawHideForPlayer(playerid, SVida6[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida5[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida4[playerid]);    // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida3[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaV <= 20)
{
TextDrawHideForPlayer(playerid, SVida6[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida5[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida4[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida3[playerid]);    // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaV <= 0)
{
TextDrawHideForPlayer(playerid, SVida6[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida5[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida4[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida3[playerid]);    // <~~ Hide
TextDrawHideForPlayer(playerid, SVida2[playerid]);    // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <= 100)
{
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida9[playerid]);
TextDrawShowForPlayer(playerid, SVida10[playerid]);
TextDrawShowForPlayer(playerid, SVida11[playerid]);
TextDrawShowForPlayer(playerid, SVida13[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <=80)
{
TextDrawHideForPlayer(playerid, SVida13[playerid]); // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida9[playerid]);
TextDrawShowForPlayer(playerid, SVida10[playerid]);
TextDrawShowForPlayer(playerid, SVida11[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <=60)
{
TextDrawHideForPlayer(playerid, SVida13[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida11[playerid]); // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida9[playerid]);
TextDrawShowForPlayer(playerid, SVida10[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <= 40)
{
TextDrawHideForPlayer(playerid, SVida13[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida11[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida10[playerid]); // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida9[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <=20)
{
TextDrawHideForPlayer(playerid, SVida13[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida11[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida10[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida9[playerid]); // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <= 15)
{
TextDrawHideForPlayer(playerid, SVida13[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida11[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida10[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida9[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida8[playerid]); // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
if(SVidaC <= 0)
{
TextDrawHideForPlayer(playerid, SVida13[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida11[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida10[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida9[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida8[playerid]); // <~~ Hide
TextDrawHideForPlayer(playerid, SVida7[playerid]); // <~~ Hide
TextDrawShowForPlayer(playerid, SVida0[playerid]);   // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida1[playerid]);  //  <~~ Fundo
TextDrawShowForPlayer(playerid, SVida12[playerid]);  // <~~ Fundo
TextDrawShowForPlayer(playerid, SVida14[playerid]);  // <~~ Fundo
}
return 1;
}

public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, SVida0[playerid]);
TextDrawShowForPlayer(playerid, SVida1[playerid]);
TextDrawShowForPlayer(playerid, SVida2[playerid]);
TextDrawShowForPlayer(playerid, SVida3[playerid]);
TextDrawShowForPlayer(playerid, SVida4[playerid]);
TextDrawShowForPlayer(playerid, SVida5[playerid]);
TextDrawShowForPlayer(playerid, SVida6[playerid]);
TextDrawShowForPlayer(playerid, SVida7[playerid]);
TextDrawShowForPlayer(playerid, SVida8[playerid]);
TextDrawShowForPlayer(playerid, SVida9[playerid]);
TextDrawShowForPlayer(playerid, SVida10[playerid]);
TextDrawShowForPlayer(playerid, SVida11[playerid]);
TextDrawShowForPlayer(playerid, SVida12[playerid]);
TextDrawShowForPlayer(playerid, SVida13[playerid]);
TextDrawShowForPlayer(playerid, SVida14[playerid]);
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawHideForPlayer(playerid, SVida0[playerid]);
TextDrawHideForPlayer(playerid, SVida1[playerid]);
TextDrawHideForPlayer(playerid, SVida2[playerid]);
TextDrawHideForPlayer(playerid, SVida3[playerid]);
TextDrawHideForPlayer(playerid, SVida4[playerid]);
TextDrawHideForPlayer(playerid, SVida5[playerid]);
TextDrawHideForPlayer(playerid, SVida6[playerid]);
TextDrawHideForPlayer(playerid, SVida7[playerid]);
TextDrawHideForPlayer(playerid, SVida8[playerid]);
TextDrawHideForPlayer(playerid, SVida9[playerid]);
TextDrawHideForPlayer(playerid, SVida10[playerid]);
TextDrawHideForPlayer(playerid, SVida11[playerid]);
TextDrawHideForPlayer(playerid, SVida12[playerid]);
TextDrawHideForPlayer(playerid, SVida13[playerid]);
TextDrawHideForPlayer(playerid, SVida14[playerid]);
return 1;
}
Imagens :

http://i.imgur.com/4S4yawo.png
Reply
#2

Legal, йpico.

Porйm poderia dar uma optimizada no cуdigo, em vez de usar a OnPlayerUpdate, poderia ter criado uma callback e usado um SetTimerEx

+rep
Reply
#3

Bom, nгo й um FS '-'

@Topic
-Muito bom, nunca vi semelhante, +REP
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)