Delete3DTextLabel Problem !
#1

Problem deleting the 3D texts, I could delete the first 3D text plus the same as I shot a drop of weapon and a weapon the text to get the 3D text if delete the command the second time the text is not deleted it still does not even logar how to keep in the window, pls observe as images, I do not usually ask for help the more I come ask because I want to solve this continue with my project.
Problem deleting the 3D texts, I could delete the first 3D text plus the same as I shot a drop of weapon and a weapon the text to get the 3D text if delete the command the second time the text is not deleted it still does not even logar how to keep in the window, pls observe as images, I do not usually ask for help the more I come ask because I want to solve this continue with my project

primeira.jpg

segunda.jpg

terceira.jpg

Код:
new Text3D:MyLabel;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/dropgun", true) == 0
	|| strcmp(cmdtext, "/dgun", true) == 0)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
        new GunID = GetPlayerWeapon(playerid);
        new GunAmmo = GetPlayerAmmo(playerid);
        if(GunID > 0 && GunAmmo != 0)
        {
            new f = MAX_OBJ+1;
            for(new a = 0; a < MAX_OBJ; a++)
            {
                if(dGunData[a][ObjPos][0] == 0.0)
                {
                    f = a;
                    break;
                }
            }
            if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "You can not throw weapons at the moment, try back later!");
			RemovePlayerWeapon(playerid, GunID);
			dGunData[f][ObjData][0] = GunID;
			dGunData[f][ObjData][1] = GunAmmo;
            GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
            new strt[128];
			format(strt,sizeof(strt),""COL_GREEN"WEAPON GEAR\n"COL_GREY"Type /pickupgun"); // TEXTO 3D
            MyLabel = Create3DTextLabel(""COL_GREEN"WEAPON GEAR\n"COL_GREY"Type /pickupgun", 0x008080FF, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-0.5, 5.0, 0, 0); // TEXTO 3D
			dGunData[f][ObjID] = CreateObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
		}
        return 1;
    }
    if(strcmp(cmdtext, "/pickupgun", true) == 0
	|| strcmp(cmdtext, "/pgun", true) == 0)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
        new f = MAX_OBJ+1;
		for(new a = 0; a < MAX_OBJ; a++)
		{
		    if(IsPlayerInRangeOfPoint(playerid, 0.5, dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
		    {
		        f = a;
		        break;
		    }
		}
		if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "You are not near the weapon which you can pick up!");
		DestroyObject(dGunData[f][ObjID]);
		GivePlayerWeapon(playerid, dGunData[f][ObjData][0], dGunData[f][ObjData][1]);
	  	dGunData[f][ObjPos][0] = 0.0;
		dGunData[f][ObjPos][1] = 0.0;
		dGunData[f][ObjPos][2] = 0.0;
		dGunData[f][ObjID] = -1;
		dGunData[f][ObjData][0] = 0;
		dGunData[f][ObjData][1] = 0;
		new buffer[50];
		format(buffer, sizeof(buffer), "You picked up %s", GunNames[dGunData[f][ObjData][0]]);
  		SendClientMessage(playerid, 0x33AA3300, buffer);

		Delete3DTextLabel(MyLabel); // TEXTO 3D
		return 1;
    }
	return 0;
}
Reply
#2

you cant do it like that.
Put MyLabel inside dGunData, then create label for each object you drop, then delete it once they get picked up like this:-

pawn Код:
enum whatever
{
    Text3D: MyLabel
}
new dGunData[MAX_OBJECTS][whatever];

//now when player drops gun
dGunData[f][MyLabel] = Create3DTextLabel(""COL_GREEN"WEAPON GEAR\n"COL_GREY"Type /pickupgun", 0x008080FF, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-0.5, 5.0, 0, 0); // TEXTO 3D

//now when player picksup gun, we have to destroy it
Delete3DTextLabel(dGunData[f][MyLabel]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)