Object destroying
#1

Hi so i want to make command when i write it i create object and when i write it again it destroy it, i made that but i dont know how to make that object destroy
Code:
COMMAND:troll(playerid,params[])
{
	if( ADMIN[playerid] == 4 )
	{

	    if( GTMODE[ GetPlayerVehicleID( playerid ) ] == false )
	    {
	    	GTMODE[ GetPlayerVehicleID( playerid ) ] = true;
	    	SendClientMessage( playerid, COLOR_LIGHTBLUE,"Create.");
new objectOne, objectTwo;
			objectOne   = CreateObject(19327, 0, 0, 0, 0, 0, 0);
			objectTwo   = CreateObject(19327, 0, 0, 0, 0, 0, 0);
			AttachObjectToVehicle(objectOne, GetPlayerVehicleID( playerid ), -1.129999, -0.334999, 0.000000, -1.004999, 0.000000, -90.449951); //Object Model: 19327 |
			AttachObjectToVehicle(objectTwo, GetPlayerVehicleID( playerid ), 1.149999, -0.339999, 0.000000, 0.000000, 0.000000, 90.449951); //Object Model: 19327 |
			SetObjectMaterialText(objectOne, "Text", 0, OBJECT_MATERIAL_SIZE_256x128,"Arial", 42, 1, 0xFFFFFFFF, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
			SetObjectMaterialText(objectTwo, "Text", 0, OBJECT_MATERIAL_SIZE_256x128,"Arial", 42, 1, 0xFFFFFFFF, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
	    	return 1;
	    }
	    else
	    {
	        GTMODE[ GetPlayerVehicleID( playerid ) ] = false;
	        SendClientMessage( playerid, COLOR_RED,"Destroy");
	    }
	}
	return 1;
}
Reply
#2

Please use [code] or [pawn] tags. It's hard to help you this way around.
Reply
#3

Okey, edited
Reply
#4

PHP Code:
COMMAND:troll(playerid,params[])
{
    if( 
ADMIN[playerid] == )
    {

        if( 
GTMODEGetPlayerVehicleIDplayerid ) ] == false )
        {
            
GTMODEGetPlayerVehicleIDplayerid ) ] = true;
            
SendClientMessageplayeridCOLOR_LIGHTBLUE,"Create.");
new 
objectOneobjectTwo;
            
objectOne   CreateObject(19327000000);
            
objectTwo   CreateObject(19327000000);
            
AttachObjectToVehicle(objectOneGetPlayerVehicleIDplayerid ), -1.129999, -0.3349990.000000, -1.0049990.000000, -90.449951); //Object Model: 19327 |
            
AttachObjectToVehicle(objectTwoGetPlayerVehicleIDplayerid ), 1.149999, -0.3399990.0000000.0000000.00000090.449951); //Object Model: 19327 |
            
SetObjectMaterialText(objectOne"Text"0OBJECT_MATERIAL_SIZE_256x128,"Arial"4210xFFFFFFFF0OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            
SetObjectMaterialText(objectTwo"Text"0OBJECT_MATERIAL_SIZE_256x128,"Arial"4210xFFFFFFFF0OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            return 
1;
        }
        else
        {
            
GTMODEGetPlayerVehicleIDplayerid ) ] = false;
            
SendClientMessageplayeridCOLOR_RED,"Destroy");
            
DestroyObject(objectOne);
            
DestroyObject(objectTwo);
        }
    }
    return 
1;

Reply
#5

tryed that but it says error 017: undefined symbol because the new is created in the if statement :/
Reply
#6

Try to move new objectOne, objectTwo; above
PHP Code:
if( GTMODEGetPlayerVehicleIDplayerid ) ] == false )
        { 
Reply
#7

pawn Code:
new objectOne, objectTwo;
COMMAND:troll(playerid,params[])
{
    if( ADMIN[playerid] == 4 )
    {

        if( GTMODE[ GetPlayerVehicleID( playerid ) ] == false )
        {
            GTMODE[ GetPlayerVehicleID( playerid ) ] = true;
            SendClientMessage( playerid, COLOR_LIGHTBLUE,"Create.");
            objectOne   = CreateObject(19327, 0, 0, 0, 0, 0, 0);
            objectTwo   = CreateObject(19327, 0, 0, 0, 0, 0, 0);
            AttachObjectToVehicle(objectOne, GetPlayerVehicleID( playerid ), -1.129999, -0.334999, 0.000000, -1.004999, 0.000000, -90.449951); //Object Model: 19327 |
            AttachObjectToVehicle(objectTwo, GetPlayerVehicleID( playerid ), 1.149999, -0.339999, 0.000000, 0.000000, 0.000000, 90.449951); //Object Model: 19327 |
            SetObjectMaterialText(objectOne, "Text", 0, OBJECT_MATERIAL_SIZE_256x128,"Arial", 42, 1, 0xFFFFFFFF, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            SetObjectMaterialText(objectTwo, "Text", 0, OBJECT_MATERIAL_SIZE_256x128,"Arial", 42, 1, 0xFFFFFFFF, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
            return 1;
        }
        else
        {
            GTMODE[ GetPlayerVehicleID( playerid ) ] = false;
            SendClientMessage( playerid, COLOR_RED,"Destroy");
            DestroyObject(objectOne);
            DestroyObject(objectTwo);
        }
    }
    return 1;
}
Reply
#8

okey that works, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)