Ship Problem error
#11

pawn Code:
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*\
||                                                                                            ||
||                                              Created 8th April 2012 By Faisal Khan (faisal3325@gmail.com).                                 ||
||              WARNING: Do NOT Claim This As Your Own. Do NOT Re-Release This Without Permission.    ||
||                                                              DO NOT SELL THIS SCRIPT!                                                                  ||
||                                        Credits: Faisal_khan, Kye and Ahemad_khan                                                ||
\*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


//=================================INCLUDES=================================//
#include <a_samp>
//=================================DEFINES==================================//
#define FILTERSCRIPT
#define NUM_SHIP_ROUTE_POINTS   2
#define SHIP_MOVE_SPEED         30.0
#define SHIP_DRAW_DISTANCE      300.0
#define NUM_SHIP_ATTACHMENTS    10
#define SHIP_HULL_ID            9585
//--------------------------------------------------------------------------//
new gShipsAttachments[NUM_SHIP_ROUTE_POINTS];
new gMainShipObjectId;
new gShipCurrentPoint = 1;
new Float:gShipHullOrigin[3] =
{ -2409.8438, 1544.9453, 7.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, 17.0469},
{-2411.3906, 1544.9453, 27.0781},
{-2485.0781, 1544.9453, 26.1953},
{-2473.5859, 1543.7734, 29.0781},
{-2474.3594, 1547.2422, 24.7500},
{-2470.2656, 1544.9609, 33.8672},
{-2470.4531, 1551.1172, 33.1406},
{-2470.9375, 1550.7500, 32.9063},
{-2474.6250, 1545.0859, 33.0625},
{-2403.5078, 1544.9453, 8.7188}
};
//This is our ship route points you can modify this as to your wish
new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = {
{2616.2410, 486.0572, -0.2505,   259.1930, 92.0, 108.0},/*route 1 <----->This is the error line*/
{2767.4495, 445.9613, -0.2555,   260.4986, 92.0, 108.0}// route 2
};

//==================================FORWARDS============================================//
forward StartMovingTimer();
//=======================================================================================//
public OnFilterScriptInit()
{
    print("\n--------------------------------");
    print("Moving Ship By Faisal_khan");
    print("--------------------------------\n");

    gMainShipObjectId = CreateObject(SHIP_HULL_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][1],
    gShipRoutePoints[0][1], gShipRoutePoints[0][1], gShipRoutePoints[0][1], 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][1] - gShipHullOrigin[1],
        0.0, 0.0, 0.0);
        x++;
    }
    SetTimer("StartMovingTimer",50*1000,0); // pause at route 0 for 50 seconds
    SendClientMessageToAll(0xDEEE20FF, "Ferry Has Docked At Bishop Tree Ferry Port");
    return 1;
}

public StartMovingTimer()
{
    MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
    gShipRoutePoints[gShipCurrentPoint][1],
    gShipRoutePoints[gShipCurrentPoint][1],
    SHIP_MOVE_SPEED / 3.0,
    gShipRoutePoints[gShipCurrentPoint][1],
    gShipRoutePoints[gShipCurrentPoint][1],
    gShipRoutePoints[gShipCurrentPoint][1]);
}

public OnObjectMoved(objectid)
{
    if(objectid != gMainShipObjectId) return 0;

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

    gShipCurrentPoint++;

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

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

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

    MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
    gShipRoutePoints[gShipCurrentPoint][1],
    gShipRoutePoints[gShipCurrentPoint][1],
    SHIP_MOVE_SPEED,
    gShipRoutePoints[gShipCurrentPoint][1],
    gShipRoutePoints[gShipCurrentPoint][1],
    gShipRoutePoints[gShipCurrentPoint][1]);

    return 1;
}


//=================================STOCK======================================//
stock PlaySoundForPlayersInRange(soundid, Float:range, Float:x, Float:y, Float:z)
{
    for(new i=0; i<MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,range,x,y,z))
            PlayerPlaySound(i, soundid, x, y, z);
}
Reply


Messages In This Thread
Ship Problem error - by [LHT]Bally - 29.04.2012, 23:12
Re: Ship Problem error - by Admigo - 29.04.2012, 23:21
Re: Ship Problem error - by [LHT]Bally - 29.04.2012, 23:22
Re: Ship Problem error - by Admigo - 29.04.2012, 23:25
Re: Ship Problem error - by AdvancedMapper - 29.04.2012, 23:25
Re: Ship Problem error - by [LHT]Bally - 29.04.2012, 23:26
Re: Ship Problem error - by TheDominator - 29.04.2012, 23:29
Re: Ship Problem error - by AdvancedMapper - 29.04.2012, 23:41
Re: Ship Problem error - by nickdodd25 - 30.04.2012, 00:10
Re: Ship Problem error - by sniperwars - 07.05.2012, 21:49
Re: Ship Problem error - by Viniborn - 07.05.2012, 21:57

Forum Jump:


Users browsing this thread: 1 Guest(s)