Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- static PlayerText:PlayerDataTD[MAX_PLAYERS][2];
- static Text:PlayerDataBOX[3];
- public OnFilterScriptInit()
- {
- /* Global TDs */
- PlayerDataBOX[0] = TextDrawCreate(621.000000, 344.000000, "_"); /* General Box */
- TextDrawBackgroundColor(PlayerDataBOX[0], 255);
- TextDrawFont(PlayerDataBOX[0], 1);
- TextDrawLetterSize(PlayerDataBOX[0], 0.500000, 9.000000);
- TextDrawColor(PlayerDataBOX[0], -1);
- TextDrawSetOutline(PlayerDataBOX[0], 0);
- TextDrawSetProportional(PlayerDataBOX[0], 1);
- TextDrawSetShadow(PlayerDataBOX[0], 1);
- TextDrawUseBox(PlayerDataBOX[0], 1);
- TextDrawBoxColor(PlayerDataBOX[0], 150);
- TextDrawTextSize(PlayerDataBOX[0], 365.000000, 0.000000);
- PlayerDataBOX[1] = TextDrawCreate(621.000000, 367.000000, "_"); /* Red Box */
- TextDrawBackgroundColor(PlayerDataBOX[1], 255);
- TextDrawFont(PlayerDataBOX[1], 1);
- TextDrawLetterSize(PlayerDataBOX[1], 0.500000, -0.500000);
- TextDrawColor(PlayerDataBOX[1], -1);
- TextDrawSetOutline(PlayerDataBOX[1], 0);
- TextDrawSetProportional(PlayerDataBOX[1], 1);
- TextDrawSetShadow(PlayerDataBOX[1], 1);
- TextDrawUseBox(PlayerDataBOX[1], 1);
- TextDrawBoxColor(PlayerDataBOX[1], -16776961);
- TextDrawTextSize(PlayerDataBOX[1], 365.000000, 0.000000);
- PlayerDataBOX[2] = TextDrawCreate(621.000000, 367.000000, "_"); /* Green Box */
- TextDrawBackgroundColor(PlayerDataBOX[2], 255);
- TextDrawFont(PlayerDataBOX[2], 1);
- TextDrawLetterSize(PlayerDataBOX[2], 0.500000, -0.500000);
- TextDrawColor(PlayerDataBOX[2], -1);
- TextDrawSetOutline(PlayerDataBOX[2], 0);
- TextDrawSetProportional(PlayerDataBOX[2], 1);
- TextDrawSetShadow(PlayerDataBOX[2], 1);
- TextDrawUseBox(PlayerDataBOX[2], 1);
- TextDrawBoxColor(PlayerDataBOX[2], 16711935);
- TextDrawTextSize(PlayerDataBOX[2], 365.000000, 0.000000);
- /* If you want to edit the TDs with 'Zamaroht TextDraw Editor'
- // Avoid problems
- new File:INI = fopen("tdlist.lst", io_write);
- new str[25];
- while(fread(INI, str))
- {
- if(!strcmp(str, "PlayerData.tde\r\n")) return fclose(INI);
- }
- INI = fopen("tdlist.lst", io_append);
- fwrite(INI, "PlayerData.tde\r\n");
- fclose(INI);
- */
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerDataTD[playerid][0] = CreatePlayerTextDraw(playerid, 373.000000, 342.000000, "_"); /* Name(ID) */
- PlayerTextDrawBackgroundColor(playerid, PlayerDataTD[playerid][0], 255);
- PlayerTextDrawFont(playerid, PlayerDataTD[playerid][0], 2);
- PlayerTextDrawLetterSize(playerid, PlayerDataTD[playerid][0], 0.360000, 2.100000);
- PlayerTextDrawColor(playerid, PlayerDataTD[playerid][0], -1);
- PlayerTextDrawSetOutline(playerid, PlayerDataTD[playerid][0], 0);
- PlayerTextDrawSetProportional(playerid, PlayerDataTD[playerid][0], 1);
- PlayerTextDrawSetShadow(playerid, PlayerDataTD[playerid][0], 1);
- PlayerDataTD[playerid][1] = CreatePlayerTextDraw(playerid, 385.000000, 371.000000, "_"); /* Data */
- PlayerTextDrawBackgroundColor(playerid, PlayerDataTD[playerid][1], 255);
- PlayerTextDrawFont(playerid,PlayerDataTD[playerid][1], 1);
- PlayerTextDrawLetterSize(playerid, PlayerDataTD[playerid][1], 0.630000, 1.900000);
- PlayerTextDrawColor(playerid, PlayerDataTD[playerid][1], -1);
- PlayerTextDrawSetOutline(playerid, PlayerDataTD[playerid][1], 1);
- PlayerTextDrawSetProportional(playerid, PlayerDataTD[playerid][1], 1);
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- new targetid = GetPlayerTargetPlayer(playerid);
- if(targetid != 0xFFFF)
- {
- /* Get player target data */
- new name[21], Float:health, Float:armour;
- new str1[25], str2[128];
- GetPlayerName(targetid, name, sizeof(name));
- GetPlayerHealth(targetid, health);
- GetPlayerArmour(targetid, armour);
- format(str1, sizeof(str1), "%s(%d)", name, targetid);
- format(str2, sizeof(str2), "Health: ~g~~h~%0.2f~n~~w~Armour: ~b~~h~%0.2f~n~~r~%s", health, armour, (!IsPlayerNPC(targetid)) ? ("Player") : ("BOT"));
- /* Show boxs */
- TextDrawShowForPlayer(playerid, PlayerDataBOX[0]);
- TextDrawShowForPlayer(playerid, PlayerDataBOX[(GetPlayerTeam(playerid) == GetPlayerTeam(targetid)) ? 2 : 1]);
- /* Update TDs and shows */
- PlayerTextDrawSetString(playerid, PlayerDataTD[playerid][0], str1);
- PlayerTextDrawSetString(playerid, PlayerDataTD[playerid][1], str2);
- PlayerTextDrawShow(playerid, PlayerDataTD[playerid][0]);
- PlayerTextDrawShow(playerid, PlayerDataTD[playerid][1]);
- }
- else
- {
- TextDrawHideForPlayer(playerid, PlayerDataBOX[0]);
- TextDrawHideForPlayer(playerid, PlayerDataBOX[1]);
- TextDrawHideForPlayer(playerid, PlayerDataBOX[2]);
- PlayerTextDrawHide(playerid, PlayerDataTD[playerid][0]);
- PlayerTextDrawHide(playerid, PlayerDataTD[playerid][1]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement