SA-MP Forums Archive
Robbery - 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: Robbery (/showthread.php?tid=558046)



Robbery - cnoopers - 15.01.2015

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;
}



Re: Robbery - Lynn - 16.01.2015

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.


Re: Robbery - cnoopers - 16.01.2015

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


Re: Robbery - Vince - 16.01.2015

'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?