help with moving bridge
#1

Can someone help me with moving bridge it dont move up just stays down.

Quote:

#include <a_samp>
//=================================DEFINES========== ========================//
#define FILTERSCRIPT
#define NUM_Bridge_ROUTE_POINTS 2
#define Bridge_MOVE_SPEED 6.0
#define Bridge_DRAW_DISTANCE 300.0
#define Bridge_ID 5191

new gMainBridgeObjectId;
new gBridgeCurrentPoint = 1;

//This is our Bridge route points you can modify this as to your wish
new Float:gBridgeRoutePoints[NUM_Bridge_ROUTE_POINTS][6] = {
{3196.3999000,486.8999900,10.8000000,0.0000000,0.0 000000,267.9950000},//route 1
{3196.3999000,486.8999900,-4.3000000,0.0000000,0.0000000,267.9950000}// route 2
};


//==================================FORWARDS======== ====================================//
forward StartMovingTimer();
public OnFilterScriptInit()
{

gMainBridgeObjectId = CreateObject(Bridge_ID, gBridgeRoutePoints[0][0], gBridgeRoutePoints[0][1], gBridgeRoutePoints[0][1],
gBridgeRoutePoints[0][1], gBridgeRoutePoints[0][1], gBridgeRoutePoints[0][1], Bridge_DRAW_DISTANCE);

SetTimer("StartMovingTimer",50*1000,0); // pause at route 0 for 50 seconds
SendClientMessageToAll(0xDEEE20FF, "Hawaii bridge moving");
return 1;
}

public StartMovingTimer()
{
MoveObject(gMainBridgeObjectId,gBridgeRoutePoints[gBridgeCurrentPoint][0],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
Bridge_MOVE_SPEED / 3.0,
gBridgeRoutePoints[gBridgeCurrentPoint][1]);
}

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

if(gBridgeCurrentPoint > 0 && !(gBridgeCurrentPoint % 1))
{
PlaySoundForPlayersInRange(6200, 200.0, gBridgeRoutePoints[gBridgeCurrentPoint][0],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
gBridgeRoutePoints[gBridgeCurrentPoint][1]);
}

gBridgeCurrentPoint++;

if(gBridgeCurrentPoint == NUM_Bridge_ROUTE_POINTS)
{
gBridgeCurrentPoint = 0;

MoveObject(gMainBridgeObjectId,gBridgeRoutePoints[gBridgeCurrentPoint][0],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
Bridge_MOVE_SPEED / 2.0,
gBridgeRoutePoints[gBridgeCurrentPoint][1]);
return 1;
}

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

MoveObject(gMainBridgeObjectId,gBridgeRoutePoints[gBridgeCurrentPoint][0],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
gBridgeRoutePoints[gBridgeCurrentPoint][1],
Bridge_MOVE_SPEED,
gBridgeRoutePoints[gBridgeCurrentPoint][1]);

return 1;
}


//=================================STOCK============ ==========================//
stock PlaySoundForPlayersInRange(soundid, Float:range, Float, 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


Forum Jump:


Users browsing this thread: 1 Guest(s)