dm zone labels
#1

Hello I have that problem for almost 2 years and I didn't solve that the problem is when player leave a dm zone command /dmexit label suposed to destroy I use DestroyDynamic3DTextLabel but it doesn't destroy. Please help. Thanks
Reply
#2

Code. Thanks.
Reply
#3

pawn Код:
if(dialogid == DM_ZONA) // timovi
    {
        if(response)
        {
            if(listitem == 0) // plavi tim
            {
                StariSkin[playerid] = GetPlayerSkin(playerid);
                PlayerInfo[playerid][pDM] = 1;
                SendClientMessage(playerid,ZUTA,"Usli ste u Plavi Tim.");
                timp[playerid] = CreateDynamic3DTextLabel("(( PLAVI ))",SVETLOPLAVA,0.0,0.0,0.6,15.0,playerid,INVALID_VEHICLE_ID,0,-1,-1,-1,100.0);
                timpl[playerid] = 1;
                GivePlayerWeapon(playerid, 16, 10);
                GivePlayerWeapon(playerid, 24, 999);
                GivePlayerWeapon(playerid, 27, 999);
                GivePlayerWeapon(playerid, 32, 999);
                GivePlayerWeapon(playerid, 31, 999);
                GivePlayerWeapon(playerid, 35, 5);
                GivePlayerWeapon(playerid, 34, 999);
                IgracUZoni[playerid] = 1;
                DMWarAktivan = true;
                SetPlayerPos(playerid, 424.3157,2536.3532,15.6639);
                PlayerInfo[playerid][pChar] = GetPlayerSkin(playerid);
                SetPlayerSkin(playerid, 285);
                dmtimer = SetTimer("DMtimerrefresh", Sec(4), true);
                dmtajmer = SetTimer("ZaustaviDMWar", Min(4), false);
            }
            if(listitem == 1) // crveni tim
            {
                StariSkin[playerid] = GetPlayerSkin(playerid);
                PlayerInfo[playerid][pDM] = 2;
                SendClientMessage(playerid,ZUTA,"Usli ste u Crveni Tim.");
                timc[playerid] = CreateDynamic3DTextLabel("(( CRVENI ))",COLOR_LIGHTRED,0.0,0.0,0.6,15.0,playerid,INVALID_VEHICLE_ID,0,-1,-1,-1,100.0);
                timcr[playerid] = 1;
                GivePlayerWeapon(playerid, 16, 10);
                GivePlayerWeapon(playerid, 24, 999);
                GivePlayerWeapon(playerid, 27, 999);
                GivePlayerWeapon(playerid, 32, 999);
                GivePlayerWeapon(playerid, 31, 999);
                GivePlayerWeapon(playerid, 35, 5);
                IgracUZoni[playerid] = 1;
                DMWarAktivan = true;
                SetPlayerPos(playerid,-723.9285,2338.4038,126.1309);
                PlayerInfo[playerid][pChar] = GetPlayerSkin(playerid);
                SetPlayerSkin(playerid, 287);
                dmtimer = SetTimer("DMtimerrefresh", Sec(4), true);
                dmtajmer = SetTimer("ZaustaviDMWar", Min(4), false);
            }
        }
        return 1;
    }
----- this is when player enter the dm zone

know this is command /dmexit

pawn Код:
CMD:dmexit(playerid, params[])
{
    if(PlayerInfo[playerid][pDM] == 1)
    {
        SetPlayerSkin(playerid, StariSkin[playerid]);
        PlayerInfo[playerid][pDM] = 0;
        timpl[playerid] = 0;
        IgracUZoni[playerid] = 0;
        SendClientMessage(playerid,SVETLOPLAVA,"[OOC DM Zona] {FFFFFF}Napustili ste OOC DM Zonu.");
        SetPlayerPos(playerid,57.5926,2299.3740,21.7211);
        ResetPlayerWeapons(playerid);
        DestroyDynamic3DTextLabel(timp[playerid]);
    }
    else if(PlayerInfo[playerid][pDM] == 2)
    {
        SetPlayerSkin(playerid, StariSkin[playerid]);
        PlayerInfo[playerid][pDM] = 0;
        IgracUZoni[playerid] = 0;
        timcr[playerid] = 0;
        SendClientMessage(playerid,SVETLOPLAVA,"[OOC DM Zona] {FFFFFF}Napustili ste OOC DM Zonu.");
        SetPlayerPos(playerid,57.5926,2299.3740,21.7211);
        ResetPlayerWeapons(playerid);
        DestroyDynamic3DTextLabel(timc[playerid]);
    }
    else return SCM(playerid, GRAD2, "{F81414}[Greska!] {C3C3C3}Ne mozete koristiti ovu komandu jel ne igrate u dm zoni!");
    return 1;
}
Reply
#4

replace your dmexit with this:
Код:
CMD:dmexit(playerid, params[])
{
printf("dmexit called, pDM is: %d",PlayerInfo[playerid][pDM]);
	switch(PlayerInfo[playerid][pDM])
	{
		case 1:
		{
        SetPlayerSkin(playerid, StariSkin[playerid]);
        PlayerInfo[playerid][pDM] = 0;
        timpl[playerid] = 0;
        IgracUZoni[playerid] = 0;
        SendClientMessage(playerid,SVETLOPLAVA,"[OOC DM Zona] {FFFFFF}Napustili ste OOC DM Zonu.");
        SetPlayerPos(playerid,57.5926,2299.3740,21.7211);
        ResetPlayerWeapons(playerid);
        DestroyDynamic3DTextLabel(timp[playerid]);
		}
		case 2:
		{
        SetPlayerSkin(playerid, StariSkin[playerid]);
        PlayerInfo[playerid][pDM] = 0;
        IgracUZoni[playerid] = 0;
        timcr[playerid] = 0;
        SendClientMessage(playerid,SVETLOPLAVA,"[OOC DM Zona] {FFFFFF}Napustili ste OOC DM Zonu.");
        SetPlayerPos(playerid,57.5926,2299.3740,21.7211);
        ResetPlayerWeapons(playerid);
        DestroyDynamic3DTextLabel(timc[playerid]);
		}
		default: SCM(playerid, GRAD2, "{F81414}[Greska!] {C3C3C3}Ne mozete koristiti ovu komandu jel ne igrate u dm zoni!");
	}
    return 1;
}
now execute the command and take a look at the server console.
if it prints a number which is not 1 or 2, then you mess'd up something when
setting PlayerInfo[playerid][pDM]
Reply
#5

it print:
dmexit called, pDM is: 1
Reply
#6

You first reset the value of timpl to 0, then you destroy the label.. the code will destroy the label-id 0.

Remove this line:

Код:
        timcr[playerid] = 0;
And if you need to reset the timcr, reset it after DestroyDynamic3DTextLabel.

Example:
Код:
        SetPlayerSkin(playerid, StariSkin[playerid]);
        PlayerInfo[playerid][pDM] = 0;
        IgracUZoni[playerid] = 0;
        SendClientMessage(playerid,SVETLOPLAVA,"[OOC DM Zona] {FFFFFF}Napustili ste OOC DM Zonu.");
        SetPlayerPos(playerid,57.5926,2299.3740,21.7211);
        ResetPlayerWeapons(playerid);
        DestroyDynamic3DTextLabel(timc[playerid]);
        timcr[playerid] = 0;
EDIT: Ops, sorry. Your variables are so similar in this names, i noticed now are different variables. Check if you dont destroy timc label first
Reply
#7

can I ask you just one question I have the same problem when I create a radar i use same createdynamic3dtextlabel ok the radar is created so and label but when a move radar /moveradar the label stay it doesn't destroy but when I use create3dtextlabel in the commaand /radar and /moveradar delete3dtextlabel then work's but I want all 3dynamic in my gamemode if you know what I mean
Reply
#8

I think you have a id-collision problem.

Post your moveradar code anyway.
Reply
#9

i use know delete3dtextlabel that work but when I try with dynamic label won't destroy, adn one question when I remove radar how can I make when typing that comand radar file in the folder delete if you know what I mean . I already have that like you see but it doesn't delete

pawn Код:
CMD:moveradar(playerid, params[])
{
    if(!IsACop(playerid)) return SCM(playerid, GRAD2, "{F81414}(Odbijeno!) {C3C3C3}Vi niste clan drzavnih organizacija!");
    if(PlayerInfo[playerid][pRank] < 3) return SCM(playerid, GRAD2, "{F81414}[Odbijeno!] {C3C3C3}Samo rank 3+ moze koristiti ovu komandu!");
    for(new i = 1; i < MAX_RADARS; i++)
    {
        new stringers[20];
        format(stringers, sizeof(stringers), "radari/radar_%d.ini", i);
        if(fexist(stringers))
        {
            RadarInfo[i][raBrzina] = 0;
            RadarInfo[i][raKazna] = 0;
            RadarInfo[i][raPrecnik] = 0;
            RadarInfo[i][raPosX] = 0;
            RadarInfo[i][raPosY] = 0;
            RadarInfo[i][raPosZ] = 0;
            Delete3DTextLabel(RadarLabel[i]);
            fremove(stringers);
        }
    }
    if(RadarKreiran[playerid] == true)
    {
        new string[128],ime[MAX_PLAYER_NAME];
        RPIme(playerid, ime);
        RadarKreiran[playerid] = false;
        format(string, 64, "%s je uklonio radar!", ime);
        ProxDetector(5.0, playerid, string, LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA);
        DestroyObject(Radar[playerid]);
    }
    else return SendClientMessage(playerid, GRAD2, "{F81414}(Odbijeno!) {C3C3C3}Nemate kreiran radar!Da kreirate:/radar");
    return 1;
}
Reply
#10

Use fremove to delete a file. https://sampwiki.blast.hk/wiki/Fremove

Anyway you create your labels with the dynamic function?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)