Robbery
#1

3D text is not creating and everything is not working. Why?
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new Text3D:label;
    new amount;
    amount = 25;

    if(hittype == BULLET_HIT_TYPE_OBJECT)
    {
        if(hitid == robbingobject)
        {
            Delete3DTextLabel(label);
            amount = amount - 1;
            new Float:x, Float:y, Float:z;
            GetObjectPos(robbingobject, x, y, z);

            new string[4];
            format(string, sizeof(string), "%i", amount);
            label = Create3DTextLabel(string, 0x00FFFFFF, x, y, z, 10.0, 0, 0);
        }
    }
    return 1;
}
Reply
#2

Going on a hunch, but is your object inside a interior?
If so, is the Interior setting the Virtual world when you enter?
Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z, FloatrawDistance, virtualworld, testLOS);

Right now your 3DText is set to VW 0.
Change it to the appropriate VW for it to show correctly.
Reply
#3

It's VW 0, blueberry shop. Added object right there but nothing happens after shot it.
Reply
#4

'label' and 'amount' are local variables which means their values are discarded when the function ends. If you want to keep a variable in memory between function calls use static instead of new.

Logically your current code should create a new label displaying 24 every time the object is shot. Yet that doesn't happen, which tells me there's something wrong on a higher level. Is the object solid? Have you verified that hitid actually contains anything?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)