SA-MP Forums Archive
How Can I Delete Spawned Objects? - 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: How Can I Delete Spawned Objects? (/showthread.php?tid=510452)



How Can I Delete Spawned Objects? - spykidz01 - 01.05.2014

title says all! i can spawn objects, but i can't delete it! because the filterscripts doesn't have /deleteobjects or etc... but it has /object [id]

Код:
dcmd_object(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
	{
	    if(!strlen(params)) return
	    SendClientMessage(playerid, LIGHTBLUE2, "Usage: /object [ObjectID]") &&
		SendClientMessage(playerid, orange, "Function: Will created a specified Object");
		
	    new ObjID = strval(params), string[128];
		new Float:X, Float:Y, Float:Z, Float:Ang;
	    SendCommandToAdmins(playerid,"Object");
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, Ang);
		X += (3 * floatsin(-Ang, degrees));
		Y += (3 * floatcos(-Ang, degrees));
		CreateObject(ObjID, X, Y, Z, 0.0, 0.0, Ang);
		format(string, sizeof(string), "CreateObject(%d, %0.2f, %0.2f, %0.2f, 0.00, 0.00, %0.2f);", ObjID, X, Y, Z, Ang);
       	SaveIn("CreatedObjects",string);
		format(string, sizeof(string), "|- Object Created: (Id: %d) (Position: X: %0.2f, Y: %0.2f, Z: %0.2f) (Angle: %0.2f) -|", ObjID, X, Y, Z, Ang);
		return SendClientMessage(playerid,yellow, string);
	}
	else return ErrorMessages(playerid, 1);
}



Re: How Can I Delete Spawned Objects? - SickAttack - 01.05.2014

Well just put this:
pawn Код:
DestroyObject(ObjID);



Re: How Can I Delete Spawned Objects? - spykidz01 - 01.05.2014

where im gonna put it? do it will automatically removes those things i created if i quit?


Re: How Can I Delete Spawned Objects? - SickAttack - 01.05.2014

If you restart the server they will automatically destroy. You can add it anywhere you want, you can create a command, asign a button that will delete the object, etc. Its up to you.


Re: How Can I Delete Spawned Objects? - spykidz01 - 01.05.2014

i want a command please.. coz i can't restart my server.. i don't have /restartserver etc cmd in my gamemode..