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

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
The right code would be:
pawn Код:
if(!strcmp(cmdtext, "/test", true))
    {  
        new objectid;
        new vehicleid;
        vehicleid=GetPlayerVehicleID(playerid);
        if(Variable == 0)
        {
            objectid = AttachObjectToVehicle(18646 ,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..
No. You're still not creating the object in this code. "objectid" is going to equal 0 here. You need to do something like this:

pawn Код:
new objectid = CreateObject(model, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(objectid, ...);
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)