#include #include #define HIDE_SECONDS 3 // for better view, keep it 2 to 4 seconds. #define DEFAULT_STATUS 1 // if you want to enable/ disable it by default. new Text:Blood, Text:Hurt, PlayerText:Damage, BloodTimer[MAX_PLAYERS], BloodStatus[MAX_PLAYERS]; public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blood on screen - by AliScripter"); print("--------------------------------------\n"); CreateGlobalBlood(); return 1; } public OnFilterScriptExit() { DestroyGlobalBlood(); return 1; } public OnPlayerConnect(playerid) { CreateLocalBlood(playerid); BloodStatus[playerid] = DEFAULT_STATUS; return 1; } public OnPlayerDisconnect(playerid, reason) { DestroyLocalBlood(playerid); return 1; } CreateLocalBlood(playerid) { Damage = CreatePlayerTextDraw(playerid, 224.000000, 276.000000, "~r~Damage taken [-99]"); PlayerTextDrawBackgroundColor(playerid, Damage, 255); PlayerTextDrawFont(playerid, Damage, 1); PlayerTextDrawLetterSize(playerid, Damage, 0.600000, 3.000000); PlayerTextDrawColor(playerid, Damage, -1); PlayerTextDrawSetOutline(playerid, Damage, 1); PlayerTextDrawSetProportional(playerid, Damage, 1); PlayerTextDrawSetSelectable(playerid, Damage, 0); return 1; } DestroyLocalBlood(playerid) { PlayerTextDrawDestroy(playerid, Damage); return 1; } CreateGlobalBlood() { Blood = TextDrawCreate(-37.000000, 2.000000, "_"); TextDrawBackgroundColor(Blood, 255); TextDrawFont(Blood, 1); TextDrawLetterSize(Blood, 0.500000, 55.000000); TextDrawColor(Blood, -1); TextDrawSetOutline(Blood, 0); TextDrawSetProportional(Blood, 1); TextDrawSetShadow(Blood, 1); TextDrawUseBox(Blood, 1); TextDrawBoxColor(Blood, -939524046); TextDrawTextSize(Blood, 640.000000, 1.000000); TextDrawSetSelectable(Blood, 0); Hurt = TextDrawCreate(257.000000, 136.000000, "~r~You are hurt"); TextDrawBackgroundColor(Hurt, 255); TextDrawFont(Hurt, 1); TextDrawLetterSize(Hurt, 0.600000, 3.000000); TextDrawColor(Hurt, -1); TextDrawSetOutline(Hurt, 1); TextDrawSetProportional(Hurt, 1); TextDrawSetSelectable(Hurt, 0); return 1; } DestroyGlobalBlood() { TextDrawDestroy(Hurt); TextDrawDestroy(Blood); return 1; } ShowBlood(playerid, Float: amount) { // Put a team check, if you are using it for a DM / TDM server. if(BloodStatus[playerid]) { new bloodstr[50]; KillTimer(BloodTimer[playerid]); TextDrawShowForPlayer(playerid, Blood); TextDrawShowForPlayer(playerid, Hurt); format(bloodstr, sizeof(bloodstr), "~r~Damage taken [%0.2f]", amount); PlayerTextDrawSetString(playerid, Damage, bloodstr); PlayerTextDrawShow(playerid, Damage); BloodTimer[playerid] = SetTimerEx("BloodTime", HIDE_SECONDS * 1000, false, "i", playerid); } else return 0; return 1; } HideBlood(playerid) { PlayerTextDrawHide(playerid, Damage); TextDrawHideForPlayer(playerid, Blood); TextDrawHideForPlayer(playerid, Hurt); return 1; } forward BloodTime(playerid); public BloodTime(playerid) { KillTimer(BloodTimer[playerid]); HideBlood(playerid); return 1; } public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID) { ShowBlood(playerid, Float: amount); } return 1; } CMD:blood(playerid) { if(BloodStatus[playerid]) { BloodStatus[playerid] = 0; SendClientMessageToAll(-1, "Blood effects are disabled."); } else { BloodStatus[playerid] = 1; SendClientMessageToAll(-1, "Blood effects are enabled."); } return 1; }