SA-MP Forums Archive
DestroyObject Not Working, - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DestroyObject Not Working, (/showthread.php?tid=229019)



DestroyObject Not Working, - External-Life - 20.02.2011

Ok, so i'm working on this code and it works for the most part just when the script goes to destroy the object it doesnt....

Код:
forward WearArmor(playerid);
Код:
SetTimerEx("WearArmor", 100, true, "is", playerid);
Код:
public WearArmor(playerid)
{
	new Float:armorstatus;
	GetPlayerArmour(playerid, armorstatus);
	if(armorstatus >= 1)
	{
		armorvest[playerid] =  CreateObject(373,0,0,0,0,0,0);
		AttachObjectToPlayer(armorvest[playerid], playerid, 0, 0, 0.5, 0, 5, 0);
	}
	else
	{
		DestroyObject(armorvest[playerid]);
	}
	return 1;
}
The object just never get's destroyed when the armor get's below 1


Re: DestroyObject Not Working, - Cameltoe - 20.02.2011

Quote:
Originally Posted by External-Life
Посмотреть сообщение
Ok, so i'm working on this code and it works for the most part just when the script goes to destroy the object it doesnt....

Код:
forward WearArmor(playerid);
Код:
SetTimerEx("WearArmor", 100, true, "is", playerid);
Код:
public WearArmor(playerid)
{
	new Float:armorstatus;
	GetPlayerArmour(playerid, armorstatus);
	if(armorstatus >= 1)
	{
		armorvest[playerid] =  CreateObject(373,0,0,0,0,0,0);
		AttachObjectToPlayer(armorvest[playerid], playerid, 0, 0, 0.5, 0, 5, 0);
	}
	else
	{
		DestroyObject(armorvest[playerid]);
	}
	return 1;
}
The object just never get's destroyed when the armor get's below 1
How do you even set the armorstatus variable to lower then 1 ?


Re: DestroyObject Not Working, - External-Life - 20.02.2011

Well if the PlayersArmour = 0 then it would set the armor variable to 0 right? also, i tried this with >= 2 to test if that was maybe the issue same problem the object is not destroyed