Hi all. I wanted to add ferriswheel filterscript to my server. it works perfectly. Now, i decided to make it work with streamer plugin. Thats the part, where i changed the code. As result - wheel isn't moving. anymore. whats wrong with it?
PHP код:
public RotateWheel()
{
UpdateWheelTarget();
new Float:fModifyWheelZPos = 0.0;
if(gWheelTransAlternate) fModifyWheelZPos = 0.05;
MoveDynamicObject( gFerrisWheel, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2]+fModifyWheelZPos,
FERRIS_WHEEL_SPEED, 0.0, gCurrentTargetYAngle, FERRIS_WHEEL_Z_ANGLE );
}
//-------------------------------------------------
public OnFilterScriptInit()
{
gFerrisWheel = CreateDynamicObject( FERRIS_WHEEL_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, -1,-1,-1, FERRIS_DRAW_DISTANCE );
gFerrisBase = CreateDynamicObject( FERRIS_BASE_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, -1,-1,-1, FERRIS_DRAW_DISTANCE );
new x=0;
while(x != NUM_FERRIS_CAGES) {
gFerrisCages[x] = CreateDynamicObject( FERRIS_CAGE_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, -1,-1,-1, FERRIS_DRAW_DISTANCE );
AttachDynamicObjectToObject( gFerrisCages[x], gFerrisWheel,
gFerrisCageOffsets[x][0],
gFerrisCageOffsets[x][1],
gFerrisCageOffsets[x][2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE+180.0, 0 );
x++;
}
SetTimer("RotateWheel",3*1000,0);
return 1;
}
//-------------------------------------------------
public OnFilterScriptExit()
{
new x=0;
DestroyDynamicObject(gFerrisWheel);
DestroyDynamicObject(gFerrisBase);
x=0;
while(x != NUM_FERRIS_CAGES) {
DestroyDynamicObject(gFerrisCages[x]);
x++;
}
return 1;
}
Up. Help please :c
PHP код:
//
// Used for testing interpolated rotations with MoveObject
// Also used to test AttachObjectToObject
// The other ferris wheel (that actually spins!)
// Located on the opposite peer at LS
//
// SA-MP 0.3d and above
//
// - Kye 2011
//
#include <a_samp>
#include "../include/gl_common.inc" // for PlaySoundForPlayersInRange()
#include <streamer>
#define NUM_FERRIS_CAGES 10
#define FERRIS_WHEEL_ID 18877
#define FERRIS_CAGE_ID 18879
#define FERRIS_BASE_ID 18878
#define FERRIS_DRAW_DISTANCE 300.0
#define FERRIS_WHEEL_SPEED 2.01
#define FERRIS_WHEEL_Z_ANGLE -90.0 // This is the heading the entire ferris wheel is at (beware of gimbal lock)
new Float:gFerrisOrigin[3] = {389.77344, -2028.50000, 22.10738};
// Cage offsets for attaching to the main wheel
new Float:gFerrisCageOffsets[NUM_FERRIS_CAGES][3] = {
{0.0699, 0.0600, -11.7500},
{-6.9100, -0.0899, -9.5000},
{11.1600, 0.0000, -3.6300},
{-11.1600, -0.0399, 3.6499},
{-6.9100, -0.0899, 9.4799},
{0.0699, 0.0600, 11.7500},
{6.9599, 0.0100, -9.5000},
{-11.1600, -0.0399, -3.6300},
{11.1600, 0.0000, 3.6499},
{7.0399, -0.0200, 9.3600}
};
// SA-MP objects
new gFerrisWheel;
new gFerrisBase;
new gFerrisCages[NUM_FERRIS_CAGES];
forward RotateWheel();
//-------------------------------------------------
new Float:gCurrentTargetYAngle = 0.0; // Angle of the Y axis of the wheel to rotate to.
new gWheelTransAlternate = 0; // Since MoveObject requires some translation target to intepolate
// rotation, the world pos target is alternated by a small amount.
UpdateWheelTarget()
{
gCurrentTargetYAngle += 36.0; // There are 10 carts, so 360 / 10
if(gCurrentTargetYAngle >= 360.0) {
gCurrentTargetYAngle = 0.0;
}
if(gWheelTransAlternate) gWheelTransAlternate = 0;
else gWheelTransAlternate = 1;
}
//-------------------------------------------------
public RotateWheel()
{
UpdateWheelTarget();
new Float:fModifyWheelZPos = 0.0;
if(gWheelTransAlternate) fModifyWheelZPos = 0.05;
MoveDynamicObject( gFerrisWheel, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2]+fModifyWheelZPos,
FERRIS_WHEEL_SPEED, 0.0, gCurrentTargetYAngle, FERRIS_WHEEL_Z_ANGLE );
}
//-------------------------------------------------
public OnFilterScriptInit()
{
gFerrisWheel = CreateDynamicObject( FERRIS_WHEEL_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, -1,-1,-1, FERRIS_DRAW_DISTANCE );
gFerrisBase = CreateDynamicObject( FERRIS_BASE_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, -1,-1,-1, FERRIS_DRAW_DISTANCE );
new x=0;
while(x != NUM_FERRIS_CAGES) {
gFerrisCages[x] = CreateDynamicObject( FERRIS_CAGE_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, -1,-1,-1, FERRIS_DRAW_DISTANCE );
AttachDynamicObjectToObject( gFerrisCages[x], gFerrisWheel,
gFerrisCageOffsets[x][0],
gFerrisCageOffsets[x][1],
gFerrisCageOffsets[x][2],
0.0, 0.0, FERRIS_WHEEL_Z_ANGLE+180.0, 0 );
x++;
}
SetTimer("RotateWheel",3*1000,0);
return 1;
}
//-------------------------------------------------
public OnFilterScriptExit()
{
new x=0;
DestroyDynamicObject(gFerrisWheel);
DestroyDynamicObject(gFerrisBase);
x=0;
while(x != NUM_FERRIS_CAGES) {
DestroyDynamicObject(gFerrisCages[x]);
x++;
}
return 1;
}
//-------------------------------------------------
public OnObjectMoved(objectid)
{
if(objectid != gFerrisWheel) return 0;
SetTimer("RotateWheel",3*1000,0);
return 1;
}
//-------------------------------------------------
public OnPlayerConnect(playerid){
RemoveBuildingForPlayer(playerid, 6463, 389.7734, -2028.4688, 19.8047, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2028.5000, 32.2266, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2021.6406, 29.9297, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2017.4531, 24.0313, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2017.4297, 16.8516, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2021.6328, 10.9844, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2028.5156, 8.7813, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2035.3984, 10.9453, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2039.6406, 16.8438, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2039.6563, 24.1094, 0.25);
RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2035.3828, 29.9531, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2039.6406, 16.8438, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2039.6563, 24.1094, 0.25);
RemoveBuildingForPlayer(playerid, 6298, 389.7734, -2028.4688, 19.8047, 0.25);
RemoveBuildingForPlayer(playerid, 6461, 389.7734, -2028.5000, 20.1094, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2028.5000, 32.2266, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2021.6406, 29.9297, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2017.4531, 24.0313, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2017.4297, 16.8516, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2021.6328, 10.9844, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2028.5156, 8.7813, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2035.3984, 10.9453, 0.25);
RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2035.3828, 29.9531, 0.25);
return 1;
}
. I haven't fund a solution to solve it. UP