All pastes #3709330 Raw Edit

Indicator System

public unlisted text v1 · immutable
#3709330 ·published 2016-09-01 19:44 UTC
rendered paste body
//*****************************
// Health / Armour Indicator  SystemV0.1
// By DarkPastx
// Release Date: 4/10/2015
// Contact: http://forum.sa-mp.com/member.php?u=254647, skype: shadowstorm730
//*****************************
#include <a_samp>
#include <zcmd>
#define FILTERSCRIPT
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Indicator FilterScript Started");
	print(" **By DarkPastx**");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else
#endif
new PlayerText:Textdraw0[MAX_PLAYERS]; //We add PlayerText and Max_Players because it's an Indicator and it's unique from player to other
new PlayerText:Textdraw1[MAX_PLAYERS]; //Declaring a Player Textdraw with MAX_PLAYERS which equals each slot for player in server
new PlayerText:Textdraw2[MAX_PLAYERS];
new PlayerText:Textdraw3[MAX_PLAYERS];
new PlayerText:Textdraw4[MAX_PLAYERS];
new PlayerText:Textdraw5[MAX_PLAYERS];

new PlayerTimer[MAX_PLAYERS];
new Float:pHealth,Float:pArmour,hstring[55];
new astring[55];
public OnGameModeExit()
{
	return 1;
}
COMMAND:indicatoron(playerid,params[])
{
if(GetPVarInt(playerid,"Indicatoron") == 0)
{
GameTextForPlayer(playerid,"Indicator ~b~turned on",2400,4);
Textdraw0[playerid] = CreatePlayerTextDraw(playerid,575.000000, 114.000000, "Health");
PlayerTextDrawBackgroundColor(playerid,Textdraw0[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw0[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw0[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw0[playerid], -1);
PlayerTextDrawSetOutline(playerid,Textdraw0[playerid], 1);
PlayerTextDrawSetProportional(playerid,Textdraw0[playerid], 1);
PlayerTextDrawUseBox(playerid,Textdraw0[playerid], 1);
PlayerTextDrawBoxColor(playerid,Textdraw0[playerid], -16776961);
PlayerTextDrawTextSize(playerid,Textdraw0[playerid], 635.000000, 36.000000);
PlayerTextDrawShow(playerid,Textdraw0[playerid]);

Textdraw1[playerid] = CreatePlayerTextDraw(playerid,486.000000, 113.000000, "Armour");
PlayerTextDrawBackgroundColor(playerid,Textdraw1[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw1[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw1[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw1[playerid], -1);
PlayerTextDrawSetOutline(playerid,Textdraw1[playerid], 1);
PlayerTextDrawSetProportional(playerid,Textdraw1[playerid], 1);
PlayerTextDrawUseBox(playerid,Textdraw1[playerid], 1);
PlayerTextDrawBoxColor(playerid,Textdraw1[playerid], 255);
PlayerTextDrawTextSize(playerid,Textdraw1[playerid], 569.000000, 0.000000);
PlayerTextDrawShow(playerid,Textdraw1[playerid]);

Textdraw2[playerid] = CreatePlayerTextDraw(playerid,560.000000, 135.000000,hstring);
TextDrawSetString(Text:Textdraw2[playerid],hstring);
PlayerTextDrawBackgroundColor(playerid,Textdraw2[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw2[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw2[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw2[playerid], -1);
PlayerTextDrawSetOutline(playerid,Textdraw2[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw2[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw2[playerid], 1);
PlayerTextDrawShow(playerid,Textdraw2[playerid]);

Textdraw3[playerid] = CreatePlayerTextDraw(playerid,482.000000, 135.000000,astring);
PlayerTextDrawBackgroundColor(playerid,Textdraw3[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw3[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw3[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw3[playerid], -1);
PlayerTextDrawSetOutline(playerid,Textdraw3[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw3[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw3[playerid], 1);
PlayerTextDrawShow(playerid,Textdraw3[playerid]); 

Textdraw4[playerid] = CreatePlayerTextDraw(playerid,557.000000, 147.000000,".");
PlayerTextDrawBackgroundColor(playerid,Textdraw3[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw3[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw3[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw3[playerid], 0x00CC00);
PlayerTextDrawSetOutline(playerid,Textdraw3[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw3[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw3[playerid], 1);
PlayerTextDrawShow(playerid,Textdraw4[playerid]);

Textdraw5[playerid] = CreatePlayerTextDraw(playerid,478.000000, 147.000000,".");
PlayerTextDrawBackgroundColor(playerid,Textdraw3[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw3[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw3[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid,Textdraw3[playerid], -1);
PlayerTextDrawSetOutline(playerid,Textdraw3[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw3[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw3[playerid], 1);
PlayerTextDrawShow(playerid,Textdraw5[playerid]); 


SetPVarInt(playerid,"Indicatoron",1);
}
else if(GetPVarInt(playerid,"Indicatoron") == 1)
{
SetPVarInt(playerid,"Indicatoroff",1);
SendClientMessage(playerid,-1,"The Indicator is already on!");
}
return 1;
}
public OnPlayerUpdate(playerid)
{
PlayerTimer[playerid] = SetTimerEx("IndicatorUpdate",400,0,"i",playerid);
GetPlayerHealth(playerid,pHealth); 
format(hstring,sizeof(hstring),"%.2f%",pHealth); 
GetPlayerArmour(playerid,pArmour); 
format(astring,sizeof(astring),"%.2f%",pArmour);
PlayerTextDrawSetString(playerid, PlayerText:Textdraw2[playerid], hstring); 
PlayerTextDrawSetString(playerid, PlayerText:Textdraw3[playerid], astring); 
if(pHealth <= 100.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw4[playerid],"(~g~~h~Excellent~w~)");
PlayerTextDrawColor(playerid,PlayerText:Textdraw4[playerid],0x00CC00);
}
if(pHealth <= 60.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw4[playerid],"(~h~~h~~b~Good~w~)");
}
if(pHealth <= 30.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw4[playerid],"(~r~~h~~h~Bad~w~)");
}
if(pHealth <= 15.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw4[playerid],"(~r~Worst~w~)");
}
//Armour Color
if(pArmour <= 100.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw5[playerid],"(~g~~h~Excellent~w~)");
}
if(pArmour <= 60.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw5[playerid],"(~h~~h~~b~Good~w~)");
}
if(pArmour <= 30.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw5[playerid],"(~r~~h~~h~Bad~w~)");
}
if(pArmour <= 15.0)
{
PlayerTextDrawSetString(playerid,PlayerText:Textdraw5[playerid],"(~r~Worst~w~)");
}
return 1;
}
COMMAND:indicatoroff(playerid,params[])
{
if(GetPVarInt(playerid,"Indicatoroff") == 0)
{
PlayerTextDrawHide(playerid,PlayerText:Textdraw0[playerid]);
PlayerTextDrawHide(playerid,PlayerText:Textdraw1[playerid]);
PlayerTextDrawHide(playerid,PlayerText:Textdraw2[playerid]);
PlayerTextDrawHide(playerid,PlayerText:Textdraw3[playerid]);
PlayerTextDrawHide(playerid,PlayerText:Textdraw4[playerid]);
PlayerTextDrawHide(playerid,PlayerText:Textdraw5[playerid]);
GameTextForPlayer(playerid,"Indicator ~r~turned off",2400,4);
SetPVarInt(playerid,"Indicatoroff",1);
}
else if(GetPVarInt(playerid,"Indicatoroff") == 1)
{
SetPVarInt(playerid,"Indicatoroff",0);
SendClientMessage(playerid,-1,"Indicator is already turned off!");
}
return 1;
}