attaching these objects, they all go to the wrong vehicle...
#7

i did it else ppl, and it works , not exactly as i wanted it, but it does works and it works properly, also the cargobob objects work, wut i did is using this filterscript(transfered it into my gm):https://sampforum.blast.hk/showthread.php?tid=280678

and had a look at it, cuz THAT filterscript DOES creates at every rhino a minigun, so i thought lets have a look at it, and i found out that i can easily add more vehicle ids etc to it, so this is wut i did:

pawn Код:
forward check( );
public check( )
{
    for( new i = 0; i < MAX_VEHICLES; ++i )
    {
        new model = GetVehicleModel( i );
        if( model == 432 )
        {
            if( vehhasminigun[ i ] == 0 )
            {
                vehhasminigun[ i ] = 1;
                mgun[ minigunnum ] = CreateDynamicObject( 2985, 0, 0, 0, 0, 0, 0, 7, -1, -1, 200.0 );
                AttachDynamicObjectToVehicle( mgun[ minigunnum ], i, 0.74, 3.37, -0.25, 0.00, 0.00, 89.47 );
                minigunnum ++;
            }
        }
        if(model == 476)
        {
            if(vehhasmissile[i] == 0)
            {
                vehhasmissile[ i ] = 1;
                AddVehicleMissiles(i, 1.364998, 0.904999);
            }
        }
        if(model == 548)
        {
            if(vehhascargo[i] == 0)
            {
                vehhascargo[i] = 1;
                AttachDynamicObjectToVehicle(CreateDynamicObject(914, 0, 0, 0, 0, 0, 0, 7, -1, -1, 100.0), i, -2.295005, -0.504999, -1.609998, -90.449951, 1.005001, 0.000000); //Object Model: 914 |
                AttachDynamicObjectToVehicle(CreateDynamicObject(914, 0, 0, 0, 0, 0, 0, 7, -1, -1, 100.0), i, -2.295005, 0.979999, -1.624998, -90.449951, 1.005001, 0.000000); //Object Model: 914 |
                AttachDynamicObjectToVehicle(CreateDynamicObject(914, 0, 0, 0, 0, 0, 0, 7, -1, -1, 100.0), i, -2.295005, 2.465008, -1.639998, -90.449951, 1.005001, 0.000000); //Object Model: 914 |
                AttachDynamicObjectToVehicle(CreateDynamicObject(914, 0, 0, 0, 0, 0, 0, 7, -1, -1, 100.0), i, 2.425007, 2.465008, -1.639998, -90.449951, 1.005001, 0.000000); //Object Model: 914 |
                AttachDynamicObjectToVehicle(CreateDynamicObject(914, 0, 0, 0, 0, 0, 0, 7, -1, -1, 100.0), i, 2.425007, 0.949999, -1.639998, -90.449951, 1.005001, 0.000000); //Object Model: 914 |
                AttachDynamicObjectToVehicle(CreateDynamicObject(914, 0, 0, 0, 0, 0, 0, 7, -1, -1, 100.0), i, 2.425007, -0.534999, -1.639998, -90.449951, 1.005001, 0.000000); //Object Model: 914 |
            }
        }
    }
    return 1;
}
forward loop( );
public loop( )
{
    for( new i = 0; i < MAX_PLAYERS; ++i )
    {
        if( IsPlayerConnected( i ) )
        {
            new vehicleid = GetPlayerVehicleID( i );
            new model = GetVehicleModel( vehicleid );
            if( model == 432 )
            {
                new
                    keys
                    ,ud
                    ,lr
                ;
                GetPlayerKeys( i, keys, ud, lr );
                if( keys & 128 )
                {
                    SetPlayerAttachedObject( i, 0, 18695, 1, 0.379999, 1.799999, -2.700000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
                    laser[ i ] = CreateObject( 19084, 0.75, 3.84, 0.86, 0.00, 0.00, 92.61 );
                    AttachObjectToVehicle( laser[ i ], vehicleid, 0.73, 4.18, 0.86, 0.00, 0.00, 88.03 );
                    PlayerPlaySound( i, 1135, 0.0, 0.0, 0.0 );
                    SetTimerEx( "destroy", 250, 0, "i", i );

                    new
                        Float:x
                        ,Float:y
                        ,Float:z
                        ,Float:x2
                        ,Float:y2
                    ;
                    GetPlayerPos( i, x2, y2, z );
                    #pragma unused x2
                    #pragma unused y2
                    GetXYInFrontOfPlayer( i, x, y, 5.0 );
                    for( new u = 0; u < MAX_PLAYERS; ++u )
                    {
                        if( IsPlayerInRangeOfPoint( u, 6.0, x, y, z ) && u != i )
                        {
                            new Float:hp;
                            new Float:armour;
                            GetPlayerArmour(u, armour);
                            if(armour != 0)
                            {
                                SetPlayerArmour(u, armour-5);
                                PlayerPlaySound( u, 1135, 0.0, 0.0, 0.0 );
                            }
                            else
                            {
                                GetPlayerHealth( u, hp );
                                SetPlayerHealth( u, hp - 5 );
                                PlayerPlaySound( u, 1135, 0.0, 0.0, 0.0 );
                            }
                            if( hp < 1 )
                                CallLocalFunction( "OnPlayerDeath", "ddd", u, i, 38 );
                        }
                    }
                }
            }
        }
    }
    return 1;
}
forward destroy( i );
public destroy( i )
{
    RemovePlayerAttachedObject( i, 0 );
    DestroyObject( laser[ i ] );
    return 1;
}
for the rest nothing, only included the VM(vehicle missile include)

anyways thanks for the help

@******, which other code did you mean?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)