Special moove of a object
#1

Hello!

I have a question about, is there anyway to make these objects move like a garage door up and down?
I just wanna know if i can make them move to that leaning position, or if they only gonna move straight up and down in the flat position of the first pic?

You can see on these pics how i mean
from this

to this


coords first pic
pawn Код:
CreateObject(3114, -810.55603027344, 420.6044921875, 17.095462799072, 0, 0, 180);
    CreateObject(3114, -789.43017578125, 420.6044921875, 17.095462799072, 0, 0, 180);
    CreateObject(3114, -768.29992675781, 420.6044921875, 17.095462799072, 0, 0, 180);
    CreateObject(3114, -747.20837402344, 420.6044921875, 17.099962234497, 0, 0, 180);
    CreateObject(3114, -726.08239746094, 420.6044921875, 17.099962234497, 0, 0, 180);
    CreateObject(3114, -704.98468017578, 420.6044921875, 17.099962234497, 0, 0, 180);
    CreateObject(3114, -683.87829589844, 420.6044921875, 17.099962234497, 0, 0, 180);
    CreateObject(3114, -662.74847412109, 420.6044921875, 17.099962234497, 0, 0, 180);
    CreateObject(3114, -641.62139892578, 420.6044921875, 17.099962234497, 0, 0, 180);
    CreateObject(3114, -620.49261474609, 420.6044921875, 17.099962234497, 0, 0, 180);
coords sec pic
pawn Код:
CreateObject(3114, -810.5556640625, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -789.4296875, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -768.2998046875, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -747.2080078125, 422.2275390625, 21.699628829956, 49.998779296875, 0, 180);
CreateObject(3114, -726.08203125, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -704.98468017578, 422.2275390625, 21.699628829956, 49.998779296875, 0, 180);
CreateObject(3114, -683.8779296875, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -662.748046875, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -641.62109375, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
CreateObject(3114, -620.4921875, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
Reply
#2

pawn Код:
// Top of your script ( after includes )
new obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10;

// GameModeInit
obj1 = CreateObject(3114, -810.55603027344, 420.6044921875, 17.095462799072, 0, 0, 180);
obj2 = CreateObject(3114, -789.43017578125, 420.6044921875, 17.095462799072, 0, 0, 180);
obj3 = CreateObject(3114, -768.29992675781, 420.6044921875, 17.095462799072, 0, 0, 180);
obj4 = CreateObject(3114, -747.20837402344, 420.6044921875, 17.099962234497, 0, 0, 180);
obj5 = CreateObject(3114, -726.08239746094, 420.6044921875, 17.099962234497, 0, 0, 180);
obj6 = CreateObject(3114, -704.98468017578, 420.6044921875, 17.099962234497, 0, 0, 180);
obj7 = CreateObject(3114, -683.87829589844, 420.6044921875, 17.099962234497, 0, 0, 180);
obj8 = CreateObject(3114, -662.74847412109, 420.6044921875, 17.099962234497, 0, 0, 180);
obj9 = CreateObject(3114, -641.62139892578, 420.6044921875, 17.099962234497, 0, 0, 180);
obj10 = CreateObject(3114, -620.49261474609, 420.6044921875, 17.099962234497, 0, 0, 180);

//---------------------------

// at your command

MoveObject( obj1, -810.5556640625, 422.2275390625, 21.699628829956, /*speed*/5.0 );
MoveObject( obj2, -789.4296875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj3, -768.2998046875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj4, -747.2080078125, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj5, -726.08203125, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj6, -704.98468017578, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj7, -683.8779296875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj8, -662.748046875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj9, -641.62109375, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj10, -620.4921875, 422.2275390625, 21.699628829956, 5.0 );
You mean like that?

Код:
* Basicz is tired.
Reply
#3

Quote:
Originally Posted by Basicz
Посмотреть сообщение
pawn Код:
// Top of your script ( after includes )
new obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10;

// GameModeInit
obj1 = CreateObject(3114, -810.55603027344, 420.6044921875, 17.095462799072, 0, 0, 180);
obj2 = CreateObject(3114, -789.43017578125, 420.6044921875, 17.095462799072, 0, 0, 180);
obj3 = CreateObject(3114, -768.29992675781, 420.6044921875, 17.095462799072, 0, 0, 180);
obj4 = CreateObject(3114, -747.20837402344, 420.6044921875, 17.099962234497, 0, 0, 180);
obj5 = CreateObject(3114, -726.08239746094, 420.6044921875, 17.099962234497, 0, 0, 180);
obj6 = CreateObject(3114, -704.98468017578, 420.6044921875, 17.099962234497, 0, 0, 180);
obj7 = CreateObject(3114, -683.87829589844, 420.6044921875, 17.099962234497, 0, 0, 180);
obj8 = CreateObject(3114, -662.74847412109, 420.6044921875, 17.099962234497, 0, 0, 180);
obj9 = CreateObject(3114, -641.62139892578, 420.6044921875, 17.099962234497, 0, 0, 180);
obj10 = CreateObject(3114, -620.49261474609, 420.6044921875, 17.099962234497, 0, 0, 180);

//---------------------------

// at your command

MoveObject( obj1, -810.5556640625, 422.2275390625, 21.699628829956, /*speed*/5.0 );
MoveObject( obj2, -789.4296875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj3, -768.2998046875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj4, -747.2080078125, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj5, -726.08203125, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj6, -704.98468017578, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj7, -683.8779296875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj8, -662.748046875, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj9, -641.62109375, 422.2275390625, 21.699628829956, 5.0 );
MoveObject( obj10, -620.4921875, 422.2275390625, 21.699628829956, 5.0 );
You mean like that?

Код:
* cruising is tired.
This i already know thanks, the question was if they gonna move to that leaning position or just flat straight up?
That was what happened when i was trying to make the carrier door in aft move just lite this
Reply
#4

Hmmm.... Moving up?
pawn Код:
// Command
new Float: objPos[ 3 ];
GetObjectPos( obj1, objPos[ 0 ], objPos[ 1 ], objPos[ 2 ] );
MoveObject( obj1, objPos[ 0 ], objPos[ 1 ], objPos[ 2 ] + 5.0 );
EDIT: OHHH I was sleepy! Now I get what do you mean!
Install this include // Not made by me
pawn Код:
/*
                +-------------------------------------------------+
                |           Script created by Gantzyo.            |
                |                                                 |
                |         You can contact with me in the          |
                |                  official post:                 |
                | http://forum.sa-mp.com/index.php?topic=176846.0 |
                |                                                 |
                |             Don't delete credits!               |
                +-------------------------------------------------+
*/


#include <a_samp>
#if defined _G_ObjectsRot_included
    #endinput
#endif
#define _G_ObjectsRot_included
#pragma library G_ObjectsRot

#define SERVER_OBJECTS 1000 //1000 is the number of objects in the server
new Float:newrotX[SERVER_OBJECTS];
new Float:newrotY[SERVER_OBJECTS];
new Float:newrotZ[SERVER_OBJECTS];
new Float:odifX[SERVER_OBJECTS];
new Float:odifY[SERVER_OBJECTS];
new Float:odifZ[SERVER_OBJECTS];
new ospeed[SERVER_OBJECTS];
new oTimer[SERVER_OBJECTS];
new oState[SERVER_OBJECTS];
new opoints[SERVER_OBJECTS];

stock RotateObject(objectid,Float:rotX,Float:rotY,Float:rotZ,points,Float:speed)
{
    if(oState[objectid] == 1)KillTimer(oTimer[objectid]);
    ospeed[objectid] = floatround(floatdiv(1000,speed),floatround_round);
    oTimer[objectid] = SetTimerEx("RotateObj",ospeed[objectid],0,"dd",objectid,points);
    newrotX[objectid] = rotX;
    newrotY[objectid] = rotY;
    newrotZ[objectid] = rotZ;
    new Float:rot[3];
    GetObjectRot(objectid,rot[0],rot[1],rot[2]);
    odifX[objectid] = (rotX-rot[0])/points;
    odifY[objectid] = (rotY-rot[1])/points;
    odifZ[objectid] = (rotZ-rot[2])/points;
    oState[objectid] = 1;
    opoints[objectid] = 0;
    return 1;
}
stock SetObjectRotationSpeed(objectid,Float:speed)
{
    ospeed[objectid] = floatround(floatdiv(1000,speed),floatround_round);
    return 1;
}
stock StopRotatingObject(objectid)
{
    if(oState[objectid] == 1)KillTimer(oTimer[objectid]);
    oState[objectid] = 0;
    OnObjectStopRotate(objectid);
    return 1;
}
stock GenerateBucle(objectid,Float:offX,Float:offY,Float:offZ,Float:speed)
{
    if(oState[objectid] == 1)KillTimer(oTimer[objectid]);
    ospeed[objectid] = floatround(floatdiv(1000,speed),floatround_round);
    oTimer[objectid] = SetTimerEx("RotateObjBucle",ospeed[objectid],0,"d",objectid);
    odifX[objectid] = offX;
    odifY[objectid] = offY;
    odifZ[objectid] = offZ;
    oState[objectid] = 1;
    return 1;
}
stock StopBucle(objectid)
{
    if(oState[objectid] == 1)KillTimer(oTimer[objectid]);
    oState[objectid] = 0;
    OnObjectStopBucle(objectid);
    return 1;
}
forward RotateObj(objectid,points);
public RotateObj(objectid,points)
{
    if(oState[objectid] == 0) return 1;
    new Float:rot[3];
    GetObjectRot(objectid,rot[0],rot[1],rot[2]);
    if(newrotX[objectid] != rot[0])rot[0]+=odifX[objectid];
    if(newrotY[objectid] != rot[1])rot[1]+=odifY[objectid];
    if(newrotZ[objectid] != rot[2])rot[2]+=odifZ[objectid];
    SetObjectRot(objectid,rot[0],rot[1],rot[2]);
    opoints[objectid]++;
    if((newrotX[objectid] != rot[0] || newrotY[objectid] != rot[1] || newrotZ[objectid] != rot[2]) && opoints[objectid] != points)oTimer[objectid] = SetTimerEx("RotateObj",ospeed[objectid],0,"dd",objectid,points);
    else {oState[objectid] = 0;OnObjectRotated(objectid);}
    return 1;
}
forward RotateObjBucle(objectid);
public RotateObjBucle(objectid)
{
    if(oState[objectid] == 0) return 1;
    new Float:rot[3];
    GetObjectRot(objectid,rot[0],rot[1],rot[2]);
    SetObjectRot(objectid,rot[0]+odifX[objectid],rot[1]+odifY[objectid],rot[2]+odifZ[objectid]);
    oTimer[objectid] = SetTimerEx("RotateObjBucle",ospeed[objectid],0,"d",objectid);
    return 1;
}
forward OnObjectRotated(objectid);
forward OnObjectStopRotate(objectid);
forward OnObjectStopBucle(objectid);
/*
native RotateObject(objectid,Float:rotX,Float:rotY,Float:rotZ,points,Float:speed);
native SetObjectRotationSpeed(objectid,Float:speed);
native StopRotatingObject(objectid);
native GenerateBucle(objectid,Float:offX,Float:offY,Float:offZ,Float:speed)
native StopBucle(objectid);
native OnObjectRotated(objectid);
native OnObjectStopRotate(objectid);
native OnObjectStopBucle(objectid);
*/
Place at SA-MP server directory / pawno / includes

Try using it's RotateObject function. ( Dunno how to use it )
Reply
#5

Quote:
Originally Posted by Basicz
Посмотреть сообщение
Hmmm.... Moving up?
pawn Код:
// Command
new Float: objPos[ 3 ];
GetObjectPos( obj1, objPos[ 0 ], objPos[ 1 ], objPos[ 2 ] );
MoveObject( obj1, objPos[ 0 ], objPos[ 1 ], objPos[ 2 ] + 5.0 );
i mean i need to have all coords for position and rotation and angle, or the objects will only move flat up and down and will not get the leaning
like this
pawn Код:
-620.4921875, 422.2275390625, 21.699628829956, 49.998779296875, 0, 179.99450683594);
if i have like this the objects will only move up in same angle
pawn Код:
-620.4921875, 422.2275390625, 21.699628829956);
Reply
#6

he wanto to rotate it, Use MoveRotateObject or something smilla, that is an include somewhere on this forum.
Reply
#7

I get this error with the include

pawn Код:
error 004: function "OnObjectRotated" is not implemented
EDT: got it to work, but i dont use OnPlayerCommandText and dont know how to convert it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)