Why doesn't this work?
#1

Just experimenting with this. This is supposed to add a text label for the shooter to the victim. The shooter would see "50" above the victims head if he gets shot with a deagle. But it doesn't even show the text at all for the shooter.

No errors whatsoever, it just doesn't show the text.


pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new string[5];
        format(string, sizeof(string), "%d", amount);
        if(DamageText[issuerid][0] != PlayerText3D:INVALID_3DTEXT_ID)
        {
            DamageText[issuerid][0] = CreatePlayer3DTextLabel(issuerid, string, 0xFFFF00FF, 0.0,0.0,13.3828, 1000.0, playerid, INVALID_VEHICLE_ID, 0);
        }
        else if(DamageText[issuerid][1] != PlayerText3D:INVALID_3DTEXT_ID)
        {
            DamageText[issuerid][1] = CreatePlayer3DTextLabel(issuerid, string, 0xFFFF00FF, 0.0,0.0,15.3828, 1000.0, playerid, INVALID_VEHICLE_ID, 0);
        }
        else if(DamageText[issuerid][2] != PlayerText3D:INVALID_3DTEXT_ID)
        {
            DamageText[issuerid][2] = CreatePlayer3DTextLabel(issuerid, string, 0xFFFF00FF, 0.0,0.0,17.3828, 1000.0, playerid, INVALID_VEHICLE_ID, 0);
        }
        else if(DamageText[issuerid][3] != PlayerText3D:INVALID_3DTEXT_ID)
        {
            DamageText[issuerid][3] = CreatePlayer3DTextLabel(issuerid, string, 0xFFFF00FF, 0.0,0.0,19.3828, 1000.0, playerid, INVALID_VEHICLE_ID, 0);
        }
        else if(DamageText[issuerid][4] != PlayerText3D:INVALID_3DTEXT_ID)
        {
            DamageText[issuerid][4] = CreatePlayer3DTextLabel(issuerid, string, 0xFFFF00FF, 0.0,0.0,21.3828, 1000.0, playerid, INVALID_VEHICLE_ID, 0);
        }
    }
    return 1;
}
Reply
#2

It's not working because you are placing it above the issuer, not the player.
Reply
#3

Nope. I'm using CreatePlayer3DTextLabel to make it show for a certain player (the shooter), the format is:

playerid The player which should see the newly created 3DText Label. (which is issuer)
text[] The text to display.
color The text color
x X Coordinate (or offset if attached)
y Y Coordinate (or offset if attached)
z Z Coordinate (or offset if attached)
DrawDistance The distance where you are able to see the 3D Text Label
attachedplayer The player you want to attach the 3D Text Label to. (None: INVALID_PLAYER_ID) Here I put playerid (the victim)
attachedvehicle The vehicle you want to attach the 3D Text Label to. (None: INVALID_VEHICLE_ID)
testLOS 0/1 Test the line-of-sight so this text can't be seen through walls
Reply
#4

This is just a guess but look at how INVALID_PLAYER_ID is used, then look at how INVALID_3DTEXT_ID is used.

pawn Код:
if(issuerid != INVALID_PLAYER_ID)
pawn Код:
if(DamageText[issuerid][0] != PlayerText3D:INVALID_3DTEXT_ID)
I would try it like this:

pawn Код:
if(DamageText[issuerid][0] != INVALID_3DTEXT_ID)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)