Help with move object
#1

hi i was wondering if anyone would make this so instead of using /moveship etc, it starts from the one point and goes to the next point every says 7 minutes, it docks at each place for 2 minutes then leaves and goes back and forwards from each port.

These are the 2 points i want it to go from please
pawn Код:
start point - 246.3412, -2980.3525, 10
end point - 249.9264,-2965.9910,-0.8070
Plus can it be made so it goes to one point first but dont stop so like 1 in the middle, because otherwise it goes through the roads etc.

Plus rep for help

pawn Код:
/*
            Ship And Dock v1 - By Kwarde
            With this filterscript, you can let a ship move (back) and (un)sink.
            It also contains a dock, where the ship is in the begin.
            Use /shiphelp ingame to see the commands

            Changelog:
                v1.0
                    - Dock created
                    - Ship frame added
                    v1.0.1
                        - Ship details added
                        - Script created
                    v1.2
                        - Added to ship: "Chill place"
                    v1.3
                        - Added to FS: Use streamer (true / false)
                    v1.3.1
                        - Added to ship: Two rooms
                    v1.4
                        - Added to ship: Control room

                    v2.0
                        - Filterscript rebuilded
                        - Restart/Reload objects

            Idea's, will be done on another time:
                - Control the script yourself


            Enjoy the script
    */


    #define USE_STREAMER    false //Change from to true if you wanna use Incognito's streamer
    #define RCON_ONLY       true //Change to false if everyone may use the commands

    #include <a_samp>
    #include <zcmd>

    #if USE_STREAMER != false
            #include <streamer>
    #endif

    #define COLOR_WHITE     0xFFFFFFAA
    #define COLOR_RED       0xFF0000AA
    #define COLOR_GREEN     0x00FF00AA
    #define COLOR_GRAY      0xAFAFAFAA

    new ShipObj[85], Dock[40];

    public OnFilterScriptInit()
    {
            SetupShip();
           
            return 1;
    }

    public OnFilterScriptExit()
    {
            for(new i = 0; i < sizeof(ShipObj); i++)
            #if USE_STREAMER == false
                DestroyObject(ShipObj[i]);
            #else
                DestroyDynamicObject(ShipObj[i]);
            #endif

            for(new i = 0; i < sizeof(Dock); i++)
            #if USE_STREAMER == false
                DestroyObject(Dock[i]);
            #else
                DestroyDynamicObject(Dock[i]);
            #endif
            return 1;
    }

    stock SetupShip()
    {
            new Float:ObjPos[3];

            #if USE_STREAMER == false
            ShipObj[0] = CreateObject(10230, 246.3412, -2980.3525, 10, 0, 0, 31.5);
        ShipObj[1] = CreateObject(8661, 253.19999694824, -2954.1999511719, 9.1999998092651, 0, 0, 31.5);
        ShipObj[2] = CreateObject(8661, 219.10000610352, -2975.1000976563, 9.1999998092651, 0, 0, 31.497802734375);
        ShipObj[3] = CreateObject(8661, 219.39999389648, -2975.8000488281, 9.1999998092651, 0, 0, 31.497802734375);
        ShipObj[4] = CreateObject(8661, 253.39999389648, -2954.8000488281, 9.1999998092651, 0, 0, 31.497802734375);
        ShipObj[5] = CreateObject(982, 252.19999694824, -2942.8000488281, 10.300000190735, 0, 0, 301.24996948242);
        ShipObj[6] = CreateObject(982, 230.30000305176, -2956.1000976563, 10.300000190735, 0, 0, 301.2451171875);
        ShipObj[7] = CreateObject(982, 208.39999389648, -2969.3999023438, 10.300000190735, 0, 0, 301.2451171875);
        ShipObj[8] = CreateObject(982, 222.39999389648, -2985.6999511719, 10.300000190735, 0, 0, 301.2451171875);
        ShipObj[9] = CreateObject(982, 232.30000305176, -2979.6999511719, 10.300000190735, 0, 0, 301.2451171875);
        ShipObj[10] = CreateObject(982, 265.60000610352, -2959.3000488281, 10.300000190735, 0, 0, 301.2451171875);
       #endif

        for(new i = 0; i < sizeof(ShipObj); i++){
        #if USE_STREAMER == false
            GetObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
            SetObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]+0.75); //In due of water in the room's
            #else
                GetDynamicObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
                SetDynamicObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[3]);
            #endif
            }
        return 1;
    }

   

    stock ResetShip()
    {
        for(new i = 0; i < sizeof(ShipObj); i++){
        #if USE_STREAMER == false
            DestroyObject(ShipObj[i]);
            #else
                DestroyDynamicObject(ShipObj[i]);
            #endif
                ShipObj[i] = (-1);
            }
            SetupShip();
            return 1;
    }

    stock MoveShipForward(Float:speed = 2.5)
    {
            new Float:ObjPos[3];
        for(new i = 0; i < sizeof(ShipObj); i++){
        #if USE_STREAMER == false
            GetObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
            MoveObject(ShipObj[i], ObjPos[0], ObjPos[1]-1000, ObjPos[2], speed); //It'll go in the land after a little while. Ignore it and continue on.
            #else
                GetDynamicObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
                MoveDynamicObject(ShipObj[i], ObjPos[0], ObjPos[1]-1000, ObjPos[2], speed);
            #endif
            }
            return 1;
    }

    stock MoveShipBackwards(Float:speed = 1.8)
    {
            new Float:ObjPos[3];
        for(new i = 0; i < sizeof(ShipObj); i++){
        #if USE_STREAMER == false
            GetObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
            MoveObject(ShipObj[i], ObjPos[0], ObjPos[1]+1000, ObjPos[2], speed); //It'll go in the land after a little while. Ignore it and continue on.
            #else
                GetDynamicObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
                MoveDynamicObject(ShipObj[i], ObjPos[0], ObjPos[1]+1000, ObjPos[2], speed);
            #endif
            }
            return 1;
    }

    stock SinkShip(Float:speed = 0.05)
    {
            new Float:ObjPos[3];
        for(new i = 0; i < sizeof(ShipObj); i++){
        #if USE_STREAMER == false
            GetObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
            MoveObject(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]-50, speed); //It'll go in the land after a little while. Ignore it and continue on.
            #else
                GetDynamicObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
                MoveDynamicObject(ShipObj[i], ObjPos[0], ObjPos[1]-50, ObjPos[2], speed);
            #endif
            }
            return 1;
    }

    stock RaiseShip(Float:speed = 2.0)
    {
            new Float:ObjPos[3];
        for(new i = 0; i < sizeof(ShipObj); i++){
        #if USE_STREAMER == false
            GetObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
            MoveObject(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]+50, speed); //It'll go in the land after a little while. Ignore it and continue on.
            #else
                GetDynamicObjectPos(ShipObj[i], ObjPos[0], ObjPos[1], ObjPos[2]);
                MoveDynamicObject(ShipObj[i], ObjPos[0], ObjPos[1]+50, ObjPos[2], speed);
            #endif
            }
            return 1;
    }

    stock StopShip()
    {
            for(new i = 0; i < sizeof(ShipObj); i++)
            #if USE_STREAMER == false
                StopObject(ShipObj[i]);
            #else
                StopDynamicObject(ShipObj[i]);
            #endif
            return 1;
    }

    CMD:gotoship(playerid, params[])
    {
            new vehicleid;
            if(GetPlayerState(playerid) != 2){
                    SetPlayerPos(playerid, 265.60000610352, -2959.3000488281, 10.300000190735);
                    SetPlayerFacingAngle(playerid, 108.967033);
            }
            else{
                vehicleid = GetPlayerVehicleID(playerid);
                SetVehiclePos(vehicleid, 109.382492, -1695.005371, 9.514464);
                SetVehicleZAngle(vehicleid, 103.027679);
                PutPlayerInVehicle(playerid, vehicleid, 0);
            }
            SendClientMessage(playerid, COLOR_GREEN, "* You've been teleported near the ship!");
            return 1;
    }

    CMD:shiphelp(playerid, params[])
    {
            SendClientMessage(playerid, COLOR_WHITE, "|----- Ship And Dock: Help -----|");
            SendClientMessage(playerid, COLOR_GREEN, "To go near the ship (at the docks): /gotoship");
            #if RCON_ONLY == true
            if(IsPlayerAdmin(playerid))
                    SendClientMessage(playerid, COLOR_GREEN, "/moveship(back)(ex) /(un)sinkship(ex) /stopship /resetship");
            else
                SendClientMessage(playerid, COLOR_GRAY, "Ask an RCON admin to handle the ship");
            #else
            SendClientMessage(playerid, COLOR_GREEN, "/moveship(back)(ex) /(un)sinkship(ex) /stopship /resetship");
            SendClientMessage(playerid, COLOR_RED, "***** Scripted and mapped by Kwarde");
            SendClientMessage(playerid, COLOR_WHITE, "|--------------------------------|");
            #endif
            return 1;
    }

    CMD:moveship(playerid, params[])
    {
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            MoveShipForward();
            SendClientMessage(playerid, COLOR_GREEN, "* The ship is now moving forward with the default speed");
            return 1;
    }

    CMD:moveshipex(playerid, params[])
    {
            new str[60];
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            if(floatstr(params[0]) > 100 || floatstr(params[0]) <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Speed must be 0-100");
            MoveShipForward(floatstr(params[0]));
            format(str, 60, "* The ship is now moving forward with the speed %f", floatstr(params[0]));
            SendClientMessage(playerid, COLOR_GREEN, str);
            return 1;
    }

    CMD:moveshipback(playerid, params[])
    {
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            MoveShipBackwards();
            SendClientMessage(playerid, COLOR_GREEN, "* The ship is now moving backwards with the default speed");
            return 1;
    }

    CMD:moveshipbackex(playerid, params[])
    {
            new str[60];
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            if(floatstr(params[0]) > 100 || floatstr(params[0]) <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Speed must be 0-100");
            MoveShipBackwards(floatstr(params[0]));
            format(str, 60, "* The ship is now moving back with the speed %f", floatstr(params[0]));
            SendClientMessage(playerid, COLOR_GREEN, str);
            return 1;
    }

    CMD:sinkship(playerid, params[])
    {
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            SinkShip();
            SendClientMessage(playerid, COLOR_GREEN, "ALERT: The ship's sinking!");
            return 1;
    }

    CMD:sinkshipex(playerid, params[])
    {
            new str[60];
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            if(floatstr(params[0]) > 100 || floatstr(params[0]) <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Speed must be 0-100");
            SinkShip(floatstr(params[0]));
            format(str, 60, "ALERT: The ship's sinking on custom speed %f!", floatstr(params[0]));
            SendClientMessage(playerid, COLOR_GREEN, str);
            return 1;
    }

    CMD:unsinkship(playerid, params[])
    {
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            RaiseShip();
            SendClientMessage(playerid, COLOR_GREEN, "ROFL the ship's raising... It's unsinking or... it's gonna fly :O");
            return 1;
    }

    CMD:unsinkshipex(playerid, params[])
    {
            new str[100];
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            if(floatstr(params[0]) > 100 || floatstr(params[0]) <= 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Speed must be 0-100");
            RaiseShip(floatstr(params[0]));
            format(str, 100, "ROFL the ship's raising... It's unsinking or... it's gonna fly :O on custom speed %f", floatstr(params[0]));
            SendClientMessage(playerid, COLOR_GREEN, str);
            return 1;
    }

    CMD:stopship(playerid, params[])
    {
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may handle the ship!");
            #endif
            StopShip();
            SendClientMessage(playerid, COLOR_GREEN, "* The ship has stopped moving");
            return 1;
    }

    CMD:resetship(playerid, params[])
    {
            #if RCON_ONLY == true
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAY, "Sorry, only RCON admins may reset the ship!");
            #endif
            ResetShip();
            SendClientMessage(playerid, COLOR_GREEN, "* Ship has been resetted");
            return 1;
    }

    CMD:text(playerid, params[])
            return GameTextForPlayer(playerid, params[0], 5000, 3);
Reply
#2

Wow lot of work man Ill try it
Reply
#3

Thankyou so much.
Reply
#4

anyone help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)