AttachDynamicObjectToVehicle & EditDynamicObject
#1

Hi guys ..

I want to make a vehicle attachaments editor, like players can edit their body objects.
This is my code:
pawn Код:
if ( listid == mHold[ 8 ] )
    {
        if ( response )
        {
            if ( !IsPlayerInAnyVehicle( playerid ) )
                return SendError( playerid, "You need to drive a vehicle to use this editor !" );
               
            new
                p_Object,
                Float:lf_v_X,
                Float:lf_v_Y,
                Float:lf_v_Z,
                VehicleID = GetPlayerVehicleID( playerid )
            ;
            GetVehiclePos( VehicleID, lf_v_X, lf_v_Y, lf_v_Z );
           
            p_Object = CreateDynamicObject( modelid, lf_v_X, lf_v_Y, lf_v_Z, 0.0, 0.0, 0.0 );
            AttachDynamicObjectToVehicle( p_Object, VehicleID, lf_v_X, lf_v_Y, lf_v_Z, 0.0, 0.0, 0.0 );
           
            Streamer_Update( playerid );
            EditDynamicObject( playerid, p_Object );
        }
    }
(part).

I tried to use EditDynamicObject without AttachDynamicObjectToVehicle and it works. When i added "AttachDynamicObjectToVehicle" and i try to edit the object, it automaticlly disappear (i think it's moved to another place, because my "mouse" is still on the screen).

What can i do?

PS> Sorry for some gramatical mistakes.
Reply
#2

Try to use arrays in the player objects.

pawn Код:
new p_Object[MAX_PLAYERS];
And now use

pawn Код:
p_Object[playerid] = CreateDynamic...
Reply
#3

Quote:
Originally Posted by arakuta
Посмотреть сообщение
Try to use arrays in the player objects.

pawn Код:
new p_Object[MAX_PLAYERS];
And now use

pawn Код:
p_Object[playerid] = CreateDynamic...
Any difference, i have changed, but anything, still the object "teleports" i don't know where ...

EDIT:
I also tried to get the object position after EditDynamicObject and compare it with player position, and:
Код:
[16:49:09] Player position: -1972.14 - X, 291.44 - Y, 34.88 - Z
[16:49:09] Object position: -1972.14 - X, 291.44 - Y, 34.88 - Z


EDIT2:
It's possible to edit an object attached to vehicle?
Reply
#4

Use CreateDynamicObjectEx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)