Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define NUM_SHIP_ROUTE_POINTS 20
- #define SHIP_HULL_ID 9585 // massive cargo ship's hull. This is used as the main object
- #define SHIP_MOVE_SPEED 10.0
- #define SHIP_DRAW_DISTANCE 3000.0
- #define NUM_SHIP_ATTACHMENTS 10
- new Float:gShipHullOrigin[3] =
- { -2409.8438, 1544.9453, 2.0000 }; // so we can convert world space to model space for attachment positions
- new gShipAttachmentModelIds[NUM_SHIP_ATTACHMENTS] = {
- 9586, // Ship main platform
- 9761, // Ship rails
- 9584, // Bridge exterior
- 9698, // Bridge interior
- 9821, // Bridge interior doors
- 9818, // Bridge radio desk
- 9819, // Captain's desk
- 9822, // Captain's seat
- 9820, // Bridge ducts and lights
- 9590 // Cargo bay area
- };
- new Float:gShipAttachmentPos[NUM_SHIP_ATTACHMENTS][3] = {
- // these are world space positions used on the original cargo ship in the game
- // they will be converted to model space before attaching
- {-2412.1250, 1544.9453, 12.0469},
- {-2411.3906, 1544.9453, 22.0781},
- {-2485.0781, 1544.9453, 21.1953},
- {-2473.5859, 1543.7734, 24.0781},
- {-2474.3594, 1547.2422, 19.7500},
- {-2470.2656, 1544.9609, 28.8672},
- {-2470.4531, 1551.1172, 28.1406},
- {-2470.9375, 1550.7500, 27.9063},
- {-2474.6250, 1545.0859, 27.0625},
- {-2403.5078, 1544.9453, 3.7188}
- };
- // Pirate ship route points (position/rotation)
- new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = {
- {2838.0313, -2371.9531, 7.2969, 0.00, 0.00, 270.0},//Porto
- {2844.4482, -2362.6050, 7.2969, 0.00, 0.00, 190.50},
- {2869.6379, -2310.5771, 7.2969, 0.00, 0.00, 156.36},
- {2917.0820, -2250.0437, 7.2969, 0.00, 0.00, 153.36},
- {3161.5376, -2055.3135, 7.2969, 0.00, 0.00, 145.74},
- {-1431.59937, 191.26247, 7.2969, 0.00, 0.00, 144.96},
- {3277.0647,-1968.2816, 7.2969, 0.00, 0.00, 167.52},
- {3532.0605,-1662.3719, 7.2969, 0.36, 0.06, 206.70},
- {4229.4663,-1070.0613, 7.2969, 0.36, 0.54, 244.80},
- {5216.6968,-602.6795, 7.2969, 1.92, -0.36, 283.26},
- {5372.9312,-658.6240, 7.2969, 0.92, -0.36, 316.32},
- {5542.2729,-884.8328, 7.2969, 0.92, -0.36, 342.54},
- {5568.6753,-1186.7546, 7.2969, 0.02, -0.06, 359.64},
- {5464.0508,-1684.8986, 7.2969, 0.02, -0.06, 359.64},
- {5260.2930,-2490.8940, 7.2969, 0.02, -0.06, 384.48},
- {4977.8237,-2990.7974, 7.2969, 0.02, -0.06, 378.54},
- {4580.2227,-3002.791, 7.2969, 0.02, -0.06, 356.28},
- {3643.6187, -3630.5256, 7.2969, 0.00, 0.00, 189.24},
- {3299.7607, -3455.6931, 7.2969, 0.00, 0.00, 215.22},
- {2870.5447, -2664.9153, 7.2969, 0.00, 0.00, 215.22}
- };
- new gShipCurrentPoint = 1; // current route point the ship is at. We start at route 1
- // SA-MP objects
- new gMainShipObjectId;
- new gShipsAttachments[NUM_SHIP_ROUTE_POINTS];
- forward StartMovingTimer();
- //-------------------------------------------------
- public StartMovingTimer()
- {
- MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
- gShipRoutePoints[gShipCurrentPoint][1],
- gShipRoutePoints[gShipCurrentPoint][2],
- SHIP_MOVE_SPEED / 2.0, // slower for the first route
- gShipRoutePoints[gShipCurrentPoint][3],
- gShipRoutePoints[gShipCurrentPoint][4],
- gShipRoutePoints[gShipCurrentPoint][5]);
- }
- //-------------------------------------------------
- forward PortoTrucker_ModeInit();
- public PortoTrucker_ModeInit()
- {
- gMainShipObjectId = CreateObject(SHIP_HULL_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][2],
- gShipRoutePoints[0][3], gShipRoutePoints[0][4], gShipRoutePoints[0][5], SHIP_DRAW_DISTANCE);
- new x=0;
- while(x != NUM_SHIP_ATTACHMENTS) {
- gShipsAttachments[x] = CreateObject(gShipAttachmentModelIds[x], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE);
- AttachObjectToObject(gShipsAttachments[x], gMainShipObjectId,
- gShipAttachmentPos[x][0] - gShipHullOrigin[0],
- gShipAttachmentPos[x][1] - gShipHullOrigin[1],
- gShipAttachmentPos[x][2] - gShipHullOrigin[2],
- 0.0, 0.0, 0.0);
- x++;
- }
- SetTimer("StartMovingTimer",30*1000,0); // pause at route 0 for 30 seconds
- return 1;
- }
- //-------------------------------------------------
- forward PortoTrucker_ModeExit();
- public PortoTrucker_ModeExit()
- {
- DestroyObject(gMainShipObjectId);
- new x=0;
- while(x != NUM_SHIP_ATTACHMENTS) {
- DestroyObject(gShipsAttachments[x]);
- x++;
- }
- return 1;
- }
- //-------------------------------------------------
- forward OnObjectMoved_Porto(objectid);
- public OnObjectMoved_Porto(objectid)
- {
- new string[128];
- gShipCurrentPoint++;
- format(string, sizeof string, "Moveu navio: %d", gShipCurrentPoint);
- SendClientMessageToAll(-1, string);
- if(gShipCurrentPoint == 1)
- {
- SetTimer("StartMovingTimer",30*1000,0); // pause at route 5 for 300 seconds
- SendClientMessageToAll(-1, "O Navio está no porto");
- return 1;
- }
- if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS)
- {
- gShipCurrentPoint = 0;
- MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
- gShipRoutePoints[gShipCurrentPoint][1],
- gShipRoutePoints[gShipCurrentPoint][2],
- SHIP_MOVE_SPEED / 2.0, // slower for the last route
- gShipRoutePoints[gShipCurrentPoint][3],
- gShipRoutePoints[gShipCurrentPoint][4],
- gShipRoutePoints[gShipCurrentPoint][5]);
- return 1;
- }
- if(gShipCurrentPoint == 1) {
- SetTimer("StartMovingTimer",30*1000,0); // pause at route 0 for 30 seconds
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement