Why is this not destroying the object? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why is this not destroying the object? (
/showthread.php?tid=417392)
Why is this not destroying the object? -
Dokins - 21.02.2013
Title says all, it doesn't destroy the weapon's object. I don't understand why, I'm using incognitos streamer etc
pawn Code:
CMD:pickupgun(playerid, params[])
{
new string[128];
for(new i=1;i < MAX_DROP_ITEMS;i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0,DropGunX[i],DropGunY[i],DropGunZ[i]))
{
if(GetPlayerVirtualWorld(playerid) == DropGunVW[i] && GetPlayerInterior(playerid) == DropGunInterior[i])
{
GivePlayerWeapon(playerid,DropGunID[i],DropGunAmmo[i]);
DropGunX[i] = 0.0;
DropGunY[i] = 0.0;
DropGunZ[i] = 0.0;
DropGunID[i] = 0;
DropGunAmmo[i] = 0;
DestroyDynamicObject(DropObject[i]);
format(string, sizeof(string), "* %s has picked up a weapon.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
}
}
}
return 1;
}
Re: Why is this not destroying the object? -
Don_Cage - 21.02.2013
Try with this
pawn Code:
CMD:pickupgun(playerid, params[])
{
new string[128];
for(new i=1;i < MAX_DROP_ITEMS;i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0,DropGunX[i],DropGunY[i],DropGunZ[i]))
{
if(GetPlayerVirtualWorld(playerid) == DropGunVW[i] && GetPlayerInterior(playerid) == DropGunInterior[i])
{
GivePlayerWeapon(playerid,DropGunID[i],DropGunAmmo[i]);
DropGunX[i] = 0.0;
DropGunY[i] = 0.0;
DropGunZ[i] = 0.0;
DropGunID[i] = 0;
DropGunAmmo[i] = 0;
DestroyObject(DropObject[i]);
format(string, sizeof(string), "* %s has picked up a weapon.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
}
}
}
return 1;
}
Not tested