08.01.2012, 15:32
When I use a command /spikestripdestroy and there's 3-4 spike strips near each other, only the first two are deleted, and the others can't be deleted
pawn Код:
stock DeleteClosestStrip(playerid)
{
new Float:x,Float:y,Float:z;
for(new i = 0; i < MAX_STRIPS; i++)
{
GetObjectPos(spikestrip[i][0], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
{
if(spikestrip[i][0] != 0)
{
DestroyObject(spikestrip[i][0]);
DestroyPickup(spikestrip[i][1]);
spikestrip[i][0] = 0; spikestrip[i][1] = 0;
GameTextForPlayer(playerid, "Spikestrip ~r~destroyed", 3000, 5);
return 1;
}
}
}
return 0;
}