08.04.2012, 12:13
(
Последний раз редактировалось Faisal_khan; 01.05.2012 в 08:52.
)
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}
};
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]);
}
pawn Код:
SHIP_MOVE_SPEED / 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;
}
pawn Код:
SHIP_MOVE_SPEED / 2.0,
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.