[FilterScript] Moving Ship
#1

Moving Ship
Hi guys this is my first Filterscript. Hope I get positive response. Have you guys ever thought of having a ship moving on its path in your gamemode? I made one. This idea was my brother’s, he helped me build the ship. Its just a simple filterscript in which we have a ship which moves on its path without disturbing others. It’s just moving no commands needed or no need to push it lol. Here we go with the explanation,
These are our ships route points which can be edited further as your wish:
pawn Код:
new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = {
{-1982.57, 2052.56, 0.00,   0.00, 0.00, 144.84},
{-2178.63, 2103.67, 0.00,   0.00, 0.00, 189.24},
{-2366.64, 2020.28, 0.00,   0.00, 0.00, 215.22},
{-2539.06, 1892.52, 0.00,   0.00, 0.00, 215.22},
{-2722.79, 1787.85, 0.00,   0.00, 0.00, 205.62},
{-2918.51, 1729.60, 0.00,   0.00, 0.00, 190.50},
{-3124.70, 1758.03, 0.00,   0.00, 0.00, 156.36},
{-3316.51, 1850.08, 0.00,   0.00, 0.00, 153.36},
{-3541.12, 1977.99, 0.00,   0.00, 0.00, 145.74},
{-3772.54, 2140.70, 0.00,   0.00, 0.00, 144.96},
{-4078.78, 2272.93, 0.00,   0.00, 0.00, 167.52},
{-4382.22, 2222.52, 0.00,   0.36, 0.06, 206.70},
{-4578.11, 2013.70, 0.00,   0.36, 0.54, 244.80},
{-4603.54, 1718.89, 0.00,   1.92, -0.36, 283.26},
{-4463.49, 1504.50, 0.00,   0.92, -0.36, 316.32},
{-4228.00, 1380.52, 0.00,   0.92, -0.36, 342.54},
{-3950.14, 1346.96, 0.00,   0.02, -0.06, 359.64},
{-3646.69, 1344.57, 0.00,   0.02, -0.06, 359.64},
{-3350.01, 1410.39, 0.00,   0.02, -0.06, 384.48},
{-2854.63, 1651.56, 0.00,   0.02, -0.06, 378.54},
{-2590.84, 1667.61, 0.00,   0.02, -0.06, 356.28},
{-2345.84, 1633.19, 0.00,   0.02, -0.06, 350.28},
{-2106.14, 1639.23, 0.00,   0.02, -0.06, 378.36},
{-1943.63, 1743.98, 0.00,   0.02, -0.06, 411.42},
{-1891.39, 1907.57, 0.00,   0.02, -0.06, 457.14}
};
This is our StartMovingTimer function:
pawn Код:
public StartMovingTimer()
{
    MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
                               gShipRoutePoints[gShipCurrentPoint][1],
                               gShipRoutePoints[gShipCurrentPoint][2],
                               SHIP_MOVE_SPEED / 3.0,
                               gShipRoutePoints[gShipCurrentPoint][3],
                               gShipRoutePoints[gShipCurrentPoint][4],
                               gShipRoutePoints[gShipCurrentPoint][5]);
}
Here you can edit the speed:
pawn Код:
SHIP_MOVE_SPEED / 3.0,
Change this value to any as your need here we have 3.0.
But don’t forget to change the speed here also:
pawn Код:
public OnObjectMoved(objectid)
{
    if(objectid != gMainShipObjectId) return 0;

    if(gShipCurrentPoint > 0 && !(gShipCurrentPoint % 5)) {
        // play some seagulls audio every 5 points
        PlaySoundForPlayersInRange(6200, 200.0, gShipRoutePoints[gShipCurrentPoint][0],
                        gShipRoutePoints[gShipCurrentPoint][1],
                        gShipRoutePoints[gShipCurrentPoint][2]);
    }

    gShipCurrentPoint++;

    if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS) {
        gShipCurrentPoint = 0;

        MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
                               gShipRoutePoints[gShipCurrentPoint][1],
                               gShipRoutePoints[gShipCurrentPoint][2],
                               SHIP_MOVE_SPEED / 2.0,
                               gShipRoutePoints[gShipCurrentPoint][3],
                               gShipRoutePoints[gShipCurrentPoint][4],
                               gShipRoutePoints[gShipCurrentPoint][5]);
        return 1;
    }

    if(gShipCurrentPoint == 1) {
        SetTimer("StartMovingTimer",30*1000,0);
        return 1;
    }

    MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
                               gShipRoutePoints[gShipCurrentPoint][1],
                               gShipRoutePoints[gShipCurrentPoint][2],
                               SHIP_MOVE_SPEED,
                               gShipRoutePoints[gShipCurrentPoint][3],
                               gShipRoutePoints[gShipCurrentPoint][4],
                               gShipRoutePoints[gShipCurrentPoint][5]);

    return 1;
}
You will find this in the above code:
pawn Код:
SHIP_MOVE_SPEED / 2.0,
If you are testing this filterscript, I also added a teleport command which will teleport you to the ship,
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/tele", true))
    {
        SetPlayerPos(playerid,-2100, 2052.56, 0);
        return 1;
    }
    return 0;
}
PICTURES






Hope you all like it.
CREDITS:

Faisal_khan
Kye some things extracted from his FS
Ahemad Khan my brother who got the idea.
Pastebin Link:

Reply


Messages In This Thread
Moving Ship - by Faisal_khan - 08.04.2012, 12:13
Re: Moving Ship - by Delete_ - 08.04.2012, 16:30
Re: Moving Ship - by Knight_Rider - 08.04.2012, 17:23
Re: Moving Ship - by ChickenKiller - 08.04.2012, 17:23
Re: Moving Ship - by Faisal_khan - 08.04.2012, 17:26
Re: Moving Ship - by Knight_Rider - 08.04.2012, 17:30
Re: Moving Ship - by organe. - 08.04.2012, 17:41
Re : Moving Ship - by Vukilore - 08.04.2012, 17:52
Re: Moving Ship - by Deanx - 08.04.2012, 18:35
Re: Moving Ship - by ChickenKiller - 08.04.2012, 19:44
Re: Moving Ship - by Issam - 08.04.2012, 19:47
Re: Moving Ship - by Faisal_khan - 09.04.2012, 09:28
Re: Moving Ship - by Phyrunx - 10.04.2012, 05:49
Re: Moving Ship - by Mamaca - 10.04.2012, 15:10
Re: Moving Ship - by thefatshizms - 11.04.2012, 14:28
Re: Moving Ship - by Juninho_Oakley - 11.04.2012, 14:32
Re: Moving Ship - by Faisal_khan - 11.04.2012, 15:32
Re: Moving Ship - by Reeshan - 11.04.2012, 15:38
Re: Moving Ship - by SublimESmokeR420 - 11.04.2012, 23:19
Re: Moving Ship - by Unknownich - 12.04.2012, 06:53
Re: Moving Ship - by Faisal_khan - 12.04.2012, 09:26
Re: Moving Ship - by antonisrodos94 - 12.04.2012, 13:02
Re: Moving Ship - by ninjahippie - 14.04.2012, 08:47
Re: Moving Ship - by StjepanSilver - 14.04.2012, 09:08
Re: Moving Ship - by Faisal_khan - 14.04.2012, 16:32
Re: Moving Ship - by ninjahippie - 18.04.2012, 09:01
Re: Moving Ship - by Niko_boy - 18.04.2012, 12:23
Re: Moving Ship - by Faisal_khan - 19.04.2012, 07:26
Re: Moving Ship - by ninjahippie - 19.04.2012, 08:09
Re: Moving Ship - by Faisal_khan - 19.04.2012, 08:12
Re: Moving Ship - by Faisal_khan - 21.11.2012, 06:50
Re: Moving Ship - by GordonP - 21.11.2012, 12:38
Re: Moving Ship - by changeME - 21.11.2012, 12:57
Re: Moving Ship - by theomanking - 21.11.2012, 13:03
Re: Moving Ship - by Faisal_khan - 21.11.2012, 13:27
Re: Moving Ship - by xXdaeminoXx - 14.03.2015, 20:58

Forum Jump:


Users browsing this thread: 1 Guest(s)