SA-MP Forums Archive
Problem with random TextDraws showing damage on different screen positions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with random TextDraws showing damage on different screen positions (/showthread.php?tid=512497)



Problem with random TextDraws showing damage on different screen positions - GwENiko - 11.05.2014

Whenever i shoot someone, or i get shot at, the textdraw will not show the amount of hits taken or made. It was supposed to come out like this:




pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
        new cstring[128];
        PlayerPlaySound(issuerid,17802,0.0,0.0,0.0);
        new pname[MAX_PLAYER_NAME], dmg[200];
        GetPlayerName(issuerid, pname, sizeof(pname));
        format(cstring, sizeof(cstring), "%s -%d", pname, amount);
        TextDrawSetString(Text:Textdraw11, dmg);
        TextDrawShowForPlayer(playerid, Text:Textdraw11);
        if(issuerid == INVALID_PLAYER_ID)
        {
        format(cstring, sizeof(cstring), "Collision -(%d)", amount);
        TextDrawSetString(Text:Textdraw11, dmg);
        TextDrawShowForPlayer(playerid, Text:Textdraw11);
        }
    return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
        new pname[MAX_PLAYER_NAME], string[30], dmg[200];
        GetPlayerName(damagedid, pname, sizeof(pname));
        format(string, sizeof(string), "%s +%d", pname, amount);
        TextDrawSetString(Text:Textdraw4, dmg);
        TextDrawShowForPlayer(playerid, Text:Textdraw4);
        return 1;
}
public OnGameModeInit()
{
        Textdraw0 = TextDrawCreate(420.000000, 299.000000, "-48");
        TextDrawBackgroundColor(Textdraw0, 255);
        TextDrawFont(Textdraw0, 1);
        TextDrawLetterSize(Textdraw0, 0.470000, 1.100000);
        TextDrawColor(Textdraw0, -14415873);
        TextDrawSetOutline(Textdraw0, 1);
        TextDrawSetProportional(Textdraw0, 0);

        Textdraw1 = TextDrawCreate(404.000000, 289.000000, "-48");
        TextDrawBackgroundColor(Textdraw1, 255);
        TextDrawFont(Textdraw1, 1);
        TextDrawLetterSize(Textdraw1, 0.470000, 1.100000);
        TextDrawColor(Textdraw1, -14415873);
        TextDrawSetOutline(Textdraw1, 1);
        TextDrawSetProportional(Textdraw1, 0);

        Textdraw2 = TextDrawCreate(392.000000, 276.000000, "-48");
        TextDrawBackgroundColor(Textdraw2, 255);
        TextDrawFont(Textdraw2, 1);
        TextDrawLetterSize(Textdraw2, 0.470000, 1.100000);
        TextDrawColor(Textdraw2, -14415873);
        TextDrawSetOutline(Textdraw2, 1);
        TextDrawSetProportional(Textdraw2, 0);

        Textdraw3 = TextDrawCreate(381.000000, 264.000000, "-48");
        TextDrawBackgroundColor(Textdraw3, 255);
        TextDrawFont(Textdraw3, 1);
        TextDrawLetterSize(Textdraw3, 0.470000, 1.100000);
        TextDrawColor(Textdraw3, -14415873);
        TextDrawSetOutline(Textdraw3, 1);
        TextDrawSetProportional(Textdraw3, 0);

        Textdraw4 = TextDrawCreate(205.000000, 256.000000, "%d");
        TextDrawBackgroundColor(Textdraw4, 255);
        TextDrawFont(Textdraw4, 1);
        TextDrawLetterSize(Textdraw4, 0.470000, 1.100000);
        TextDrawColor(Textdraw4, 16711935);
        TextDrawSetOutline(Textdraw4, 1);
        TextDrawSetProportional(Textdraw4, 0);

        Textdraw5 = TextDrawCreate(179.000000, 237.000000, "%d");
        TextDrawBackgroundColor(Textdraw5, 255);
        TextDrawFont(Textdraw5, 1);
        TextDrawLetterSize(Textdraw5, 0.470000, 1.100000);
        TextDrawColor(Textdraw5, 16711935);
        TextDrawSetOutline(Textdraw5, 1);
        TextDrawSetProportional(Textdraw5, 0);

        Textdraw6 = TextDrawCreate(160.000000, 276.000000, "%d");
        TextDrawBackgroundColor(Textdraw6, 255);
        TextDrawFont(Textdraw6, 1);
        TextDrawLetterSize(Textdraw6, 0.470000, 1.100000);
        TextDrawColor(Textdraw6, 16711935);
        TextDrawSetOutline(Textdraw6, 1);
        TextDrawSetProportional(Textdraw6, 0);

        Textdraw7 = TextDrawCreate(210.000000, 216.000000, "%d");
        TextDrawBackgroundColor(Textdraw7, 255);
        TextDrawFont(Textdraw7, 1);
        TextDrawLetterSize(Textdraw7, 0.470000, 1.100000);
        TextDrawColor(Textdraw7, 16711935);
        TextDrawSetOutline(Textdraw7, 1);
        TextDrawSetProportional(Textdraw7, 0);

        Textdraw8 = TextDrawCreate(200.000000, 293.000000, "%d");
        TextDrawBackgroundColor(Textdraw8, 255);
        TextDrawFont(Textdraw8, 1);
        TextDrawLetterSize(Textdraw8, 0.470000, 1.100000);
        TextDrawColor(Textdraw8, 16711935);
        TextDrawSetOutline(Textdraw8, 1);
        TextDrawSetProportional(Textdraw8, 0);

        Textdraw9 = TextDrawCreate(151.000000, 310.000000, "%d");
        TextDrawBackgroundColor(Textdraw9, 255);
        TextDrawFont(Textdraw9, 1);
        TextDrawLetterSize(Textdraw9, 0.470000, 1.100000);
        TextDrawColor(Textdraw9, 16711935);
        TextDrawSetOutline(Textdraw9, 1);
        TextDrawSetProportional(Textdraw9, 0);

        Textdraw10 = TextDrawCreate(370.000000, 250.000000, "-48");
        TextDrawBackgroundColor(Textdraw10, 255);
        TextDrawFont(Textdraw10, 1);
        TextDrawLetterSize(Textdraw10, 0.470000, 1.100000);
        TextDrawColor(Textdraw10, -14415873);
        TextDrawSetOutline(Textdraw10, 1);
        TextDrawSetProportional(Textdraw10, 0);

        Textdraw11 = TextDrawCreate(434.000000, 310.000000, "-48");
        TextDrawBackgroundColor(Textdraw11, 255);
        TextDrawFont(Textdraw11, 1);
        TextDrawLetterSize(Textdraw11, 0.470000, 1.100000);
        TextDrawColor(Textdraw11, -14415873);
        TextDrawSetOutline(Textdraw11, 1);
        TextDrawSetProportional(Textdraw11, 0);
}
i only named as -48, +48 because i didn't know how to make the textdraw to display the proper value when the player takes or gives damage by different weapons, please help is very appreciated.