Please Help!
#1

I made drop system for my server and sometimes it works just fine, but sometimes it doesn't delete 3DTextLabel.

There is a peace of script:
Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_WALK))
{
for(new i=0; i<MAX_DROPS; i++)
{
if(IsPlayerInRangeOfPoint(playerid,1.5,DrpX[i], DrpY[i], DrpZ[i]))
{
new msg[128];
AddItem(playerid, DropItemName[i], DropItemAmount[i]);
format(msg, 128, "Gavai: %s, %i", DropItemName[i], DropItemAmount[i]);
SSM(playerid, true, msg);
DestroyDrop(i);
return 1;
}
}
return 1;
}

Quote:

#define MAX_DROPS 600

//------------------------------------------------------------------------------

new DrpCount = -1;
new Float:DrpX[MAX_DROPS],
Float:DrpY[MAX_DROPS],
Float:DrpZ[MAX_DROPS],
DropItemName[MAX_DROPS][MAX_ITEM_NAME],
DropItemAmount[MAX_DROPS],
DropTimer[MAX_DROPS],
Text3D:DropLabel[MAX_DROPS];


//------------------------------------------------------------------------------



//------------------------------------------------------------------------------

stock Drop(playerid, bool:drp, drpitem[])
{
DrpCount ++;
new ID = DrpCount;
if(!drp)
{
new Float:coo[3];
GetPlayerPos(playerid, coo[0], coo[1], coo[2]);
for(new gg=0; gg<MAX_DROPS; gg++)
{
if(coo[0]==DrpX[gg] && coo[1]==DrpY[gg]) coo[0]+=0.05;
}
DrpX[ID] = coo[0];
DrpY[ID] = coo[1];
DrpZ[ID] = coo[2];
new idx=random(10),amount,itemname[MAX_ITEM_NAME],tmp[128];
GetPlayerItemInfo(playerid,idx,itemname,_,amount);
RemoveItem(playerid, itemname, amount);
DropItemAmount[ID]=amount;
format(DropItemName[ID],64,"%s",itemname);
format(tmp, 128, "%s, {FF9900}%i\n{33CCFF}ALT", DropItemName[ID], DropItemAmount[ID]);
DropLabel[ID] = Create3DTextLabel(tmp, COLOR_GOLD, coo[0], coo[1], coo[2]-0.75, 40.0, 0, 1);
DropTimer[ID] = SetTimerEx("DropRemoval", 1000*90, false, "i", ID);
}
else
{
new Float:coo[3];
GetPlayerPos(playerid, coo[0], coo[1], coo[2]);
for(new gg=0; gg<MAX_DROPS; gg++)
{
if(coo[0]==DrpX[gg] && coo[1]==DrpY[gg]) coo[0]+=0.05;
}
DrpX[ID] = coo[0];
DrpY[ID] = coo[1];
DrpZ[ID] = coo[2];
new tmp[128];
DropItemAmount[ID]=PlayerHasItem(playerid, drpitem);
if(DropItemAmount[ID] == 0) DropItemAmount[ID]=1;
RemoveItem(playerid, drpitem, PlayerHasItem(playerid, drpitem));
format(DropItemName[ID],64,"%s",drpitem);
format(tmp, 128, "%s, {FF9900}%i\n{33CCFF}ALT", DropItemName[ID], DropItemAmount[ID]);
DropLabel[ID] = Create3DTextLabel(tmp, COLOR_GOLD, coo[0], coo[1], coo[2]-0.75, 40.0, 0,1);
DropTimer[ID] = SetTimerEx("DropRemoval", 1000*90, false, "i", ID);
}
}

forward DropRemoval(g);

public DropRemoval(g)
{
Delete3DTextLabel(DropLabel[dropid]);
DrpX[dropid] = 0.0;
DrpY[dropid] = 0.0;
DrpZ[dropid] = -1000.0;
DrpCount --;
}

Please Help!
Reply
#2

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)