08.02.2014, 18:09
Hello so when I remove created object radar and moveradar then it should be destroy dynamic3dtextlabel but that label stay
CMD:radar(playerid,params[])
{
if(gPlayerLogged[playerid] != 1)
{
SCM(playerid,SIVA,"{FFFFFF}[{F81414}G-Protect{FFFFFF}] {C3C3C3}Morate biti logirani za koristenje ove komande!");
return 1;
}
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!");
if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Ne smijete biti u vozilu!");
new brz,kaz,prc;
if(sscanf(params,"iii",brz,prc,kaz)) return SCM(playerid,-1,"{FFAF00}Koristite: {FFFFFF}/radar [Brzina za mjerenje] [Radius] [Kazna 10-500]");
if(brz < 60 || brz > 140) return SCM(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Minimalna brzina je 60 km/h,a maksimalna brzina je 140 km/h!");
if(prc < 10.0 || prc > 50.0) return SCM(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Radius ne moze biti manji od 10.0,a veci od 50.0!");
if(kaz < 1 || kaz > 500) return SCM(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Cijena kazne ne moze biti manja od $1,a veca od $500!");
for(new i = 0; i < MAX_RADARS; i++)
{
new stringers[64];
format(stringers,64,"/radari/Radar_%d.ini",i);
if(!fexist(stringers))
{
if(RadarKreiran[playerid] == false)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(i,X,Y,Z);
SetPlayerPos_H(i,X+1,Y+1,Z);
RadarInfo[i][raBrzina] = brz;
RadarInfo[i][raKazna] = kaz;
RadarInfo[i][raPrecnik] = prc;
RadarInfo[i][raPosX] = X;
RadarInfo[i][raPosY] = Y;
RadarInfo[i][raPosZ] = Z;
new File:radarfajl = fopen(stringers,io_write);
fclose(radarfajl);
SaveRadar(i);
Radar[playerid] = CreateObject(18880,RadarInfo[i][raPosX],RadarInfo[i][raPosY],RadarInfo[i][raPosZ]-1.6,0.00000000,0.00000000,0.00000000,60);
SCMF(playerid,BELA,"ID kreiranog radara: %d",i);
RadarKreiran[playerid] = true;
new string[128],ime[MAX_PLAYER_NAME];
RPIme(playerid,ime);
Radarlabel[playerid] = 1;
format(string,sizeof(string),"(( %s | Brzina: %d ))",ime,brz);
RadarLabel[i] = CreateDynamic3DTextLabel(string,BELA,RadarInfo[i][raPosX],RadarInfo[i][raPosY],RadarInfo[i][raPosZ]+1.0,60.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0);
format(string,64,"%s je postavio radar!",ime);
ProxDetector(5.0,playerid,string,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA);
i = 998;
}
}
else return SCM(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Vec imate kreiran radar!(koristite /ukloniradar da maknete postojeci!)");
}
return 1;
}
CMD:moveradar(playerid,params[])
{
if(gPlayerLogged[playerid] != 1)
{
SCM(playerid,SIVA,"{FFFFFF}[{F81414}G-Protect{FFFFFF}] {C3C3C3}Morate biti logirani za koristenje ove komande!");
return 1;
}
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 = 0; i < MAX_RADARS; i++)
{
new RadarFajl[64];
format(RadarFajl,64,"/radari/Radar_%d.ini",i);
if(fexist(RadarFajl))
{
if(RadarKreiran[playerid] == true)
{
if(!IsPlayerInRangeOfPoint(playerid,5.0,RadarInfo[i][raPosX],RadarInfo[i][raPosY],RadarInfo[i][raPosZ])) return SCM(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Ne nalazite se u blizini radara!(Dodjite blize i koristite /ukloniradar!)");
new string[128],ime[MAX_PLAYER_NAME];
RPIme(playerid,ime);
RadarInfo[i][raBrzina] = 0;
RadarInfo[i][raKazna] = 0;
RadarInfo[i][raPrecnik] = 0;
RadarInfo[i][raPosX] = 0;
RadarInfo[i][raPosY] = 0;
RadarInfo[i][raPosZ] = 0;
Radarlabel[i] = 0;
DestroyDynamic3DTextLabel(RadarLabel[i]);
fremove(RadarFajl);
RadarKreiran[playerid] = false;
format(string,128,"%s je uklonio radar.",ime);
ProxDetector(5.0,playerid,string,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA);
DestroyObject(Radar[playerid]);
return 1;
}
}
else return SendClientMessage(playerid,GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Nemate kreiran radar!Da kreirate koristite /radar!");
}
return 1;
}
DestroyDynamic3DTextLabel(RadarLabel[i]);
DestroyDynamic3DTextLabel(RadarLabel[playerid]);