[Include] [0.3c] Vehicle Missiles
#41

good work.I'm gona try this in my testing server.
Reply
#42

Great Job!
Reply
#43

Quote:
Originally Posted by Geryy
Посмотреть сообщение
Necessary also get speed vehicle, because if speed vehicle > rocket - it explosion yours car.
You just need to adjust #define MISSILE_SPEED 40.0 in the include and it will probaly be fixed.
Reply
#44

Looking good, thanks.
Reply
#45

You should update this so we could use it on planes that not always have the front straight like the cars have, so you can fire when ex diving or fly upwards and the rockets shooting in same fronting angle.

And also one more thing why that is needed, if you use this on a airplane, the rockets hitting your wings if you not flying straight or up, you can also blow your self up when they hit your wing when firing.
Reply
#46

Awesome!
Reply
#47

can you update to 0.3d r2?
Reply
#48

Hey, i tried to script this and think everything is succeeded except for one thing. its the same problem as barneystinson had, but i dont understand where i'll put the coordinates (x and z). doesnt they already exist. for me it looks like this:

AddVehicleMissiles(Vehicle,1.1,0.0,-0.2);
or isnt it even here i'll change it?
please answer fast as possible cause i'll have a big lan at my place and i want to have the missiles ready 'til then.
its a really nice script
Reply
#49

And what is the command for this
Reply
#50

How can I increase the meters the object(missile) should move ? I mean, just try to set detonate time 1000 and fire the missile. After some time missile is stucked. How can I increase the length of that ?

EDIT: Never-mind, I figured it out.
Reply
#51

eehm wutever i do, it doesnt attaches the missiles to my vehicle

this is wut i have:

the include, changed it cuz the objects have to be spawned in world 7, since i use worlds
pawn Code:
//Backwardsman97

#include <a_samp>
#include <streamer>
/*------------------------------------
native AddVehicleMissiles(vehicleid,Float:offsetx,Float:offsetz)
native RemoveVehicleMissiles(vehicleid)
native IsVehicleHot(vehicleid)
-------------------------------------*/


#define MISSILE_DETONATE_TIME 500   //milliseconds
#define MISSILE_EXPLODE_TYPE 10
#define MISSILE_EXPLODE_RADIUS 10.0
#define MISSILE_SPEED 40.0
#define MISSILE_FIRE_KEY 1

new VehicleFire[MAX_VEHICLES];
new VehicleBomb[MAX_VEHICLES][2];
new VehicleSmok[MAX_VEHICLES][2];
new Float:VehicleOffsetX[MAX_VEHICLES];
new Float:VehicleOffsetZ[MAX_VEHICLES];

forward VM_OnPlayerKeyStateChange(playerid,newkeys);
forward VM_Explode(vehicleid,mode);
forward VM_OnVehicleFire(vehicleid,slot);

stock AddVehicleMissiles(vehicleid,Float:offsetx,Float:offsetz)
{
    if(!VehicleFire[vehicleid])
    {
        new Float:x,Float:u;
        GetVehiclePos(vehicleid,x,u,u);
        if(x != 0)
        {
            if(!IsValidDynamicObject(VehicleBomb[vehicleid][1]))
            {

                VehicleBomb[vehicleid][0] = CreateDynamicObject(3790,0.0,0.0,0.0,0.0,0.0,0.0,7,-1,-1,300.0);
                VehicleBomb[vehicleid][1] = CreateDynamicObject(3790,0.0,0.0,0.0,0.0,0.0,0.0,7,-1,-1,300.0);

                AttachDynamicObjectToVehicle(VehicleBomb[vehicleid][0],vehicleid,offsetx,0,offsetz,0,0,270);
                AttachDynamicObjectToVehicle(VehicleBomb[vehicleid][1],vehicleid,-offsetx,0,offsetz,0,0,270);

                VehicleOffsetX[vehicleid] = offsetx;
                VehicleOffsetZ[vehicleid] = offsetz;
                return 1;
            }
        }
    }
    return 0;
}

stock RemoveVehicleMissiles(vehicleid)
{
    if(!VehicleFire[vehicleid])
    {
        if(IsValidDynamicObject(VehicleBomb[vehicleid][1]))
        {
            if(VehicleBomb[vehicleid][0])
            {
                DestroyDynamicObject(VehicleBomb[vehicleid][0]);
                DestroyDynamicObject(VehicleBomb[vehicleid][1]);
                return 1;
            }
            return DestroyDynamicObject(VehicleBomb[vehicleid][1]),1;
        }
    }
    return 0;
}

stock IsVehicleHot(vehicleid)
{
    if(IsValidDynamicObject(VehicleBomb[vehicleid][1]))
        return 1;

    return 0;
}


public VM_OnPlayerKeyStateChange(playerid,newkeys)
{
    if((newkeys & MISSILE_FIRE_KEY) == (MISSILE_FIRE_KEY))
    {
        new id = GetPlayerVehicleID(playerid);
        if(!VehicleFire[id])
        {
            if(id)
            {
                if(IsValidObject(VehicleBomb[id][1]))
                {
                    new
                    Float:x,
                    Float:y,
                    Float:z,
                    Float:a;


                    VehicleFire[id] = 1;

                    if(IsValidDynamicObject(VehicleBomb[id][0]))
                    {
                        DestroyDynamicObject(VehicleBomb[id][0]);

                        GetVehiclePos(id,x,y,z);
                        GetVehicleZAngle(id,a);

                        a += 270;
                        z += VehicleOffsetZ[id];

                        x += (VehicleOffsetX[id] * floatsin(-a, degrees));
                        y += (VehicleOffsetX[id] * floatcos(-a, degrees));

                        VehicleBomb[id][0] = CreateDynamicObject(3790,x,y,z,0.0,0.0,a,7,-1,-1,300.0);
                        VehicleSmok[id][0] = CreateDynamicObject(18731,x,y,z-1.3,0.0,0.0,0.0,7,-1,-1,300.0);

                        a += 90;

                        x += (30 * floatsin(-a, degrees));
                        y += (30 * floatcos(-a, degrees));

                        MoveDynamicObject(VehicleBomb[id][0],x,y,z,MISSILE_SPEED);
                        MoveDynamicObject(VehicleSmok[id][0],x,y,z-1.3,MISSILE_SPEED);

                        SetTimerEx("VM_Explode",MISSILE_DETONATE_TIME,0,"dd",id,0);
                        VM_OnVehicleFire(id,0);
                        return 1;
                    }
                    DestroyDynamicObject(VehicleBomb[id][1]);

                    GetVehiclePos(id,x,y,z);
                    GetVehicleZAngle(id,a);

                    a += 90;
                    z += VehicleOffsetZ[id];

                    x += (VehicleOffsetX[id] * floatsin(-a, degrees));
                    y += (VehicleOffsetX[id] * floatcos(-a, degrees));

                    VehicleBomb[id][1] = CreateDynamicObject(3790,x,y,z,0,0,a+180,7,-1,-1,300.0);
                    VehicleSmok[id][1] = CreateDynamicObject(18731,x,y,z-1.3,0,0,0,7,-1,-1,300.0);

                    a += 270;

                    x += (30 * floatsin(-a, degrees));
                    y += (30 * floatcos(-a, degrees));

                    MoveDynamicObject(VehicleBomb[id][1],x,y,z,MISSILE_SPEED);
                    MoveDynamicObject(VehicleSmok[id][1],x,y,z-1.3,MISSILE_SPEED);

                    SetTimerEx("VM_Explode",MISSILE_DETONATE_TIME,0,"dd",id,1);
                    VM_OnVehicleFire(id,1);
                    return 1;
                }
            }
            return 1;
        }
    }
    return 1;
}

public VM_Explode(vehicleid,mode)
{
    if(IsValidDynamicObject(VehicleBomb[vehicleid][mode]))
    {
        new
        Float:x,
        Float:y,
        Float:z;

        GetDynamicObjectPos(VehicleBomb[vehicleid][mode],x,y,z);
        CreateExplosion(x,y,z,MISSILE_EXPLODE_TYPE,MISSILE_EXPLODE_RADIUS);

        DestroyDynamicObject(VehicleBomb[vehicleid][mode]);
        DestroyDynamicObject(VehicleSmok[vehicleid][mode]);

        VehicleFire[vehicleid] = 0;
        return 1;
    }
    return 1;
}
wut i got in my script:
(ofc the #include <VM>)
pawn Code:
// top of script
new Rustler[5];
// ongamemodeinit
Rustler[0] = CreateVehicleInWorld(476, -1353.4000244, -2330.6000977, 62.5999985, 180.0000000, -1, -1, 7);
    Rustler[1] = CreateVehicleInWorld(476, -1369.9000244, -2331.0000000, 62.5999985, 180.0000000, -1, -1, 7);
    AddVehicleMissiles(Rustler[0],-1.324998, -0.904999);
    AddVehicleMissiles(Rustler[1],-1.324998, -0.904999);
Rustler[2] = CreateVehicleInWorld(476, -1685.4000244, -2290.0000000, 42.9000015, 0.0000000, -1, -1, 7);
    Rustler[3] = CreateVehicleInWorld(476, -1697.4000244, -2289.0000000, 44.0999985, 354.0000000, -1, -1, 7);
    Rustler[4] = CreateVehicleInWorld(476, -1718.8000488, -2310.3000488, 45.5999985, 93.9968262, -1, -1, 7);
    AddVehicleMissiles(Rustler[2],-1.324998, -0.904999);
    AddVehicleMissiles(Rustler[3],-1.324998, -0.904999);
    AddVehicleMissiles(Rustler[4],-1.324998, -0.904999);
i DO have the VM_Onplayerkeystatechange at my onplayerkeystatechange, and i also have the callback added of VM_Onvehiclefire... so wuts the problem here? why they dont get created?
Reply
#52

Wowzers, I see a donator feature in the making.
Reply
#53

Hey,
THX For The Script but i have Error look:

Code:
PHP Code:
C:\Users\ben\Documents\BestModEver!\pawno\include\VM.inc(57) : error 001expected token","but found "]"
C:\Users\ben\Documents\BestModEver!\pawno\include\VM.inc(57) : error 029invalid expressionassumed zero
C
:\Users\ben\Documents\BestModEver!\filterscripts\FDzY61GL.PWN(24) : warning 217loose indentation
C
:\Users\ben\Documents\BestModEver!\filterscripts\FDzY61GL.PWN(26) : warning 217loose indentation
C
:\Users\ben\Documents\BestModEver!\filterscripts\FDzY61GL.PWN(29) : warning 202number of arguments does not match definition
C
:\Users\ben\Documents\BestModEver!\filterscripts\FDzY61GL.PWN(32) : warning 217loose indentation
C
:\Users\ben\Documents\BestModEver!\filterscripts\FDzY61GL.PWN(34) : warning 217loose indentation
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
2 Errors

IDK How to Fix that Error... i Have no the Line 57... i have until the line 47.
Someone Can help me? Please?
Thank You.
Reply
#54

can someone make a filterscript of it pls i need it pleas help me
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)