DestroyObject doesn't work when attached to vehicle?
#4

The right code would be:
pawn Код:
new objectid;//outside the command

if(!strcmp(cmdtext, "/test", true))
    {  
       
        new vehicleid;
        vehicleid=GetPlayerVehicleID(playerid);
        if(Variable == 0)
        {
            objectid = CreateObject(18646,0,0,0,0,0,0);
            AttachObjectToVehicle(objectid ,vehicleid, -0.034999, 1.749998, 0.329999, 0.000000, 0.000000, 0.000000); //Object Model: 18646 |
            Variable = 1;
            return 1;
        }
        else if(Variable == 1)
        {
            DestroyObject(objectid);
            Variable = 0;
            return 1;
        }
        return 1;
    }
This should work the way it's supposed to work..
EDIT: edited the code with RealCop's change and edited with FufLa's change, now it should work
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)