#include <a_samp>#include \"../include/gl_common.inc\" // for PlaySoundForPlayersInRange()#define NUM_SHIP_ROUTE_POINTS 2#define SHIP_OBJECT_ID 5837 // pirate ship#define SHIP_MOVE_SPEED 40#define SHIP_DRAW_DISTANCE 800.0// Pirate ship route points (position/rotation)new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = {{-2102.3003, -2226.0457, 33.7934, -0.0400, 0.0000, -219.9600},{-2279.5198, -1818.1901, 484.2934, -0.0400, 0.0000, -219.9600}}; //new gShipCurrentPoint = 1; // current route point the ship is atnew gShipCurrentPoint = 0;// SA-MP objectsnew gMainShipObjectId;forward StartMovingTimer();//-------------------------------------------------public StartMovingTimer(){MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],gShipRoutePoints[gShipCurrentPoint][1],gShipRoutePoints[gShipCurrentPoint][2],SHIP_MOVE_SPEED / 4.0, // bit slower for the first pointgShipRoutePoints[gShipCurrentPoint][3],gShipRoutePoints[gShipCurrentPoint][4],gShipRoutePoints[gShipCurrentPoint][5]);}//-------------------------------------------------public OnFilterScriptInit(){gMainShipObjectId = CreateObject(SHIP_OBJECT_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][2],gShipRoutePoints[0][3], gShipRoutePoints[0][4], gShipRoutePoints[0][5], SHIP_DRAW_DISTANCE);SetTimer(\"StartMovingTimer\",30*1000,0); // pause at route 0 for 30 secondsreturn 1;}//-------------------------------------------------public OnFilterScriptExit(){ DestroyObject(gMainShipObjectId);return 1;}//-------------------------------------------------public OnObjectMoved(objectid){ if(objectid != gMainShipObjectId) return 0;if(gShipCurrentPoint > 0 && !(gShipCurrentPoint % 1)) {} gShipCurrentPoint++; if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS) {gShipCurrentPoint = 0; MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], gShipRoutePoints[gShipCurrentPoint][1],gShipRoutePoints[gShipCurrentPoint][2],SHIP_MOVE_SPEED / 4.0, // slower for the last routegShipRoutePoints[gShipCurrentPoint][3],gShipRoutePoints[gShipCurrentPoint][4],gShipRoutePoints[gShipCurrentPoint][5]);return 1;}if(gShipCurrentPoint == 1) { // Before heading to the first route we should wait a bitStopObject(gMainShipObjectId); SetTimer(\"StartMovingTimer\",30*1000,0); // pause at route 0 for 30 secondsreturn 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;}
#include <a_samp>#define NUM_SHIP_ROUTE_POINTS 2#define SHIP_OBJECT_ID 5837 // pirate ship#define SHIP_DRAW_DISTANCE 800.0forward StartShipTimer();forward MoveShip();// Hajó Objectnew ShipObject;// Hajó aktuális útvonalnew ShipRoute;// Útvonal adatszerkezetenum RouteData{Float:Pos[3],Float:Rot[3],Float:Speed,StopTime};// Útvonal Adatoknew Float:ShipRoutePoints[NUM_SHIP_ROUTE_POINTS][RouteData] ={// 0{ // Pos{-2102.3003, -2226.0457, 33.7934},// Rot{-0.0400, 0.0000, -219.9600},// Speed40.0,// StopTime (millisec)30000},// 1{ // Pos{-2279.5198, -1818.1901, 484.2934},// Rot{-0.0400, 0.0000, -219.9600},4.0,// StopTime (millisec)30000}};// Amikor betöltődik a scriptpublic OnFilterScriptInit(){// Hajó létrehozásaShipRoute = 0; ShipObject = CreateObject(SHIP_OBJECT_ID,ShipRoutePoints[shipRoute][Pos][0],ShipRoutePoints[shipRoute][Pos][1],ShipRoutePoints[shipRoute][Pos][2],ShipRoutePoints[shipRoute][Rot][0],ShipRoutePoints[shipRoute][Rot][1],ShipRoutePoints[shipRoute][Rot][2],SHIP_DRAW_DISTANCE);// Hajó időzítő indításaStartShipTimer();return 1;}// Amikor kitöltődik a scriptpublic OnFilterScriptExit(){DestroyObject(ShipObject);return 1;}// Amikor megállt egy tárgypublic OnObjectMoved(objectid){// HA a mozgatott tárgy a Hajóif(objectid == ShipObject){ // Hajó időzítő indítása StartShipTimer();}return 1;}// Hajó mozgatásapublic MoveShip(){// Következő útvonalra ugrás ShipRoute++;// Ha végig ment akkor újra kezdiif(ShipRoute >= NUM_SHIP_ROUTE_POINTS) { ShipRoute = 0; }// Hajó mozgatásaMoveObject(ShipObject,ShipRoutePoints[shipRoute][Pos][0],ShipRoutePoints[shipRoute][Pos][1],ShipRoutePoints[shipRoute][Pos][2],ShipRoutePoints[shipRoute][speed],ShipRoutePoints[shipRoute][Rot][0],ShipRoutePoints[shipRoute][Rot][1],ShipRoutePoints[shipRoute][Rot][2]);return 1;}// Hajó időzítő indításapublic StartShipTimer(){// HA NEM kell állniaif(ShipRoutePoints[shipRoute][stopTime] == 0){ // Hajó mozgatása MoveShip();}// HA állnia kellelse{ // Állás után Hajó mozgatása SetTimer(\"MoveShip\",ShipRoutePoints[shipRoute][stopTime],false);}}