SA-MP Forums Archive
Angle of gate won't move - 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: Angle of gate won't move (/showthread.php?tid=544918)



Angle of gate won't move - sammp - 04.11.2014

Object won't move. It spawns, it loads perfectly, just not sure why the angle won't move.

The object is ID 968, but i don't know what's wrong:

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, GateInfo[gate][gRange], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ]))
                {
                    if(GateInfo[gate][gModel] == 968)
                    {
                        if(GateInfo[gate][gStatus] == STATUS_GATE_CLOSED)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]+90, 7.0);
                            GateInfo[gate][gStatus] = STATUS_GATE_OPEN;
                        }
                        else if(GateInfo[gate][gStatus] == STATUS_GATE_OPEN)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]-90, 7.0);
                            GateInfo[gate][gStatus] = STATUS_GATE_CLOSED;
                        }
                    }
                    else
                    {
                        if(GateInfo[gate][gStatus] == STATUS_GATE_CLOSED)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]+90, 7.0);
                        }
                        else if(GateInfo[gate][gStatus] == STATUS_GATE_OPEN)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]-90, 7.0);
                        }
                    }
                }



Re: Angle of gate won't move - Vince - 04.11.2014

In order for MoveObject to work correctly, the object has to be moved, even if it's just by 0.001 units.


Re: Angle of gate won't move - sammp - 04.11.2014

Yeah, just looked it up on the wiki moments before you replied. Thanks anyhow!


Re: Angle of gate won't move - sammp - 04.11.2014

Still not moving the object, put +0.001 on the X axis and it's not working.


Re: Angle of gate won't move - Pottus - 04.11.2014

Repost your code I know you will have issues with this...

MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]-90, 7.0);

You don't need -90 since it has to move to it's return position.


Re: Angle of gate won't move - sammp - 05.11.2014

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Repost your code I know you will have issues with this...

MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]-90, 7.0);

You don't need -90 since it has to move to it's return position.
Sorry I don't understand what you mean?

If you're looking for the code here it is:

pawn Код:
if(gate != -1)
            {
                if(IsPlayerInRangeOfPoint(playerid, GateInfo[gate][gRange], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ]))
                {
                    if(GateInfo[gate][gModel] == 968)
                    {
                        if(GateInfo[gate][gStatus] == STATUS_GATE_CLOSED)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX]+0.001, GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]+90, 7.0);
                            GateInfo[gate][gStatus] = STATUS_GATE_OPEN;
                        }
                        else if(GateInfo[gate][gStatus] == STATUS_GATE_OPEN)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX]-0.001, GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]-90, 7.0);
                            GateInfo[gate][gStatus] = STATUS_GATE_CLOSED;
                        }
                    }
                    else
                    {
                        if(GateInfo[gate][gStatus] == STATUS_GATE_CLOSED)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX]+0.001, GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]+90, 7.0);
                        }
                        else if(GateInfo[gate][gStatus] == STATUS_GATE_OPEN)
                        {
                            MoveDynamicObject(GateInfo[gate][gModel], GateInfo[gate][gX]-0.001, GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gRX], GateInfo[gate][gRY], GateInfo[gate][gRZ]-90, 7.0);
                        }
                    }
                }
            }