SA-MP Forums Archive
Gate does not move how I want it to. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Gate does not move how I want it to. (/showthread.php?tid=443490)



Gate does not move how I want it to. - Stefand - 12.06.2013

I made a automatic open PD gate, but it does not show motion, when you come close it just stands open without moving.

I dont see any mistakes in my script so..

pawn Код:
pdgate = CreateObject(968, 1544.68005, -1630.89001, 13.05000,   0.00000, 90.00000, 90.00000);

if(Factions[Player[i][Faction]][CommandTypes] == 1 || Factions[Player[i][Faction]][CommandTypes] == 3)
                {
                    if(pdgatestatus == 0)
                    {
                        if(IsPlayerInRangeOfPoint(i, 20, 1544.6823, -1627.3782, 12.3759))
                        {
                            pdgatestatus = 1;
                            MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
                            SetTimerEx("ClosePDGate", 7000, false, "");
                        }
                    }
                }

public ClosePDGate()
{
    if(pdgatestatus == 1)
    {
        pdgatestatus = 0;
        MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1,  0.00000, 90.00000, 90.00000);
    }
    return 1;
}
EDIT: Picture added




Re: Gate does not move how I want it to. - AntonioCroatia - 12.06.2013

you don't have i

try this:
Код:
pdgate = CreateObject(968, 1544.68005, -1630.89001, 13.05000,   0.00000, 90.00000, 90.00000);

if(!IsPlayerConnected(i));
{
if(Factions[Player[i][Faction]][CommandTypes] == 1 || Factions[Player[i][Faction]][CommandTypes] == 3)
                {
                    if(pdgatestatus == 0)
                    {
                        if(IsPlayerInRangeOfPoint(i, 20, 1544.6823, -1627.3782, 12.3759))
                        {
                            pdgatestatus = 1;
                            MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
                            SetTimerEx("ClosePDGate", 7000, false, "");
                        }
                    }
                }
}

public ClosePDGate()
{
    if(pdgatestatus == 1)
    {
        pdgatestatus = 0;
        MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1,  0.00000, 90.00000, 90.00000);
    }
    return 1;
}
sry I'm on mobile


Re: Gate does not move how I want it to. - Stefand - 12.06.2013

I have i, its under a check that checks every 1 sec, so when it is close to the object it will automaticly open. It opens but not correct...


Re: Gate does not move how I want it to. - AntonioCroatia - 12.06.2013

does you got any warn error?


Re: Gate does not move how I want it to. - Stefand - 12.06.2013

nope, again IT WORKS but not correctly, it just spawn in the position how it should be after moving


Re: Gate does not move how I want it to. - Pottus - 12.06.2013

You didn't even set it to move correctly, you need to give a small movement on the X, Y or Z axis.

https://sampwiki.blast.hk/wiki/MoveObject

"Important Note: This function can be used to make objects rotate smoothly. In order to achieve this however, the object must also be moved. The specified rotation is the rotation the object will have after the movement. Hence the object will not rotate when no movement is applied. For a script example take a look at the ferriswheel.pwn filterscript made by Kye included in the server package (SA-MP 0.3d and above)."

pawn Код:
CreateObject(968, 1544.68005, -1630.89001, 13.05000,   0.00000, 90.00000, 90.00000);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1,  0.00000, 90.00000, 90.00000);



Re: Gate does not move how I want it to. - Stefand - 12.06.2013

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
You didn't even set it to move correctly, you need to give a small movement on the X, Y or Z axis.

https://sampwiki.blast.hk/wiki/MoveObject

"Important Note: This function can be used to make objects rotate smoothly. In order to achieve this however, the object must also be moved. The specified rotation is the rotation the object will have after the movement. Hence the object will not rotate when no movement is applied. For a script example take a look at the ferriswheel.pwn filterscript made by Kye included in the server package (SA-MP 0.3d and above)."

pawn Код:
CreateObject(968, 1544.68005, -1630.89001, 13.05000,   0.00000, 90.00000, 90.00000);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1,  0.00000, 90.00000, 90.00000);
So how should the code look like then?

pawn Код:
CreateObject(968, 1544.68, -1630.89, 13.05,   0.00, 90.00, 90.00);
MoveObject(pdgate, 1544.68, -1630.89, 13.05, 1, 0.00,0.00, 90.00);
MoveObject(pdgate, 1544.68, -1630.89, 13.05, 1,  0.000, 90.00, 90.00);



Re: Gate does not move how I want it to. - Stefand - 12.06.2013

Oke tried the code above same problem..


Re: Gate does not move how I want it to. - park4bmx - 12.06.2013

you are trying to move the Gate in the exact same position !
the only difference i saw was under the conditon if(pdgatestatus == 0)
you didnt add the last rotation parameter if you want it to rotate that then you need to add a [b]value[/u] !
e.g. 0.00


Re: Gate does not move how I want it to. - Stefand - 12.06.2013

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
you are trying to move the Gate in the exact same position !
the only difference i saw was under the conditon if(pdgatestatus == 0)
you didnt add the last rotation parameter if you want it to rotate that then you need to add a [b]value[/u] !
e.g. 0.00
Check two posts up, its changed and still not working