SA-MP Forums Archive
FS:Gates Compiling Error - 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: FS:Gates Compiling Error (/showthread.php?tid=462676)



FS:Gates Compiling Error - jblac240 - 08.09.2013

FSGates.pwn(280 ) : error 010: invalid function or declaration

These are the includes that are needed and I have them up to date
#include <a_samp>
#include <ZCMD>
#include <Dini>


This is the code:
public OnObjectMoved(objectid)
for( new i = 0; i != MAX_GATES; i++ )
{
if( GateInfo[i][gCreated] == 1 )
{
if( GateInfo[i][gObject] == objectid )
{
if( GateInfo[i][gStatus] == GATE_STATE_CLOSED )
GateInfo[i][gStatus] = GATE_STATE_OPEN;
else if( GateInfo[i][gStatus] == GATE_STATE_OPEN )
GateInfo[i][gStatus] = GATE_STATE_CLOSED;

// Update the variables.
new FloatPos[3];
GetObjectPos( objectid, oPos[0], oPos[1], oPos[2] );
GateInfo[i][gX] = oPos[0];
GateInfo[i][gY] = oPos[1];
GateInfo[i][gZ] = oPos[2];
break;
}
}
}
return 1; < This is line 280
}


Re: FS:Gates Compiling Error - WLSF - 08.09.2013

Try this:
pawn Код:
public OnObjectMoved(objectid)
{
    for( new i = 0; i != MAX_GATES; i++ )
    {
        if( GateInfo[i][gCreated] == 1 )
        {
            if( GateInfo[i][gObject] == objectid )
            {
                if( GateInfo[i][gStatus] == GATE_STATE_CLOSED )
                    GateInfo[i][gStatus] = GATE_STATE_OPEN;
                else if( GateInfo[i][gStatus] == GATE_STATE_OPEN )
                    GateInfo[i][gStatus] = GATE_STATE_CLOSED;

                // Update the variables.
                new FloatPos[3];
                GetObjectPos( objectid, oPos[0], oPos[1], oPos[2] );
                GateInfo[i][gX] = oPos[0];
                GateInfo[i][gY] = oPos[1];
                GateInfo[i][gZ] = oPos[2];
                break;
            }
        }
    }
    return 1;
}



Re: FS:Gates Compiling Error - jblac240 - 08.09.2013

Quote:
Originally Posted by Willian_Luigi
Посмотреть сообщение
Try this:
pawn Код:
public OnObjectMoved(objectid)
{
    for( new i = 0; i != MAX_GATES; i++ )
    {
        if( GateInfo[i][gCreated] == 1 )
        {
            if( GateInfo[i][gObject] == objectid )
            {
                if( GateInfo[i][gStatus] == GATE_STATE_CLOSED )
                    GateInfo[i][gStatus] = GATE_STATE_OPEN;
                else if( GateInfo[i][gStatus] == GATE_STATE_OPEN )
                    GateInfo[i][gStatus] = GATE_STATE_CLOSED;

                // Update the variables.
                new FloatPos[3];
                GetObjectPos( objectid, oPos[0], oPos[1], oPos[2] );
                GateInfo[i][gX] = oPos[0];
                GateInfo[i][gY] = oPos[1];
                GateInfo[i][gZ] = oPos[2];
                break;
            }
        }
    }
    return 1;
}
Thank you! Rep'd!