SA-MP Forums Archive
Undefined symbol, Comile 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: Undefined symbol, Comile error.. (/showthread.php?tid=318292)



Undefined symbol, Comile error.. - davve95 - 14.02.2012

Hi!


I get a problem when I compile... :

Код:
C:\Users\Davve\Desktop\Bases\Base1\NY.pwn(288) : error 017: undefined symbol "Gate"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I have this under game mode int:

pawn Код:
new Gate;
Gate = CreateObject(980,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000); //object(airportgate) (1) //closed gate
.


And this under OnPlayerCommandText:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/open", cmdtext, true, 10) == 0)
    {

        CreateObject(980,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000); //object(airportgate) (1)
        return 1;
    }   MoveObject(Gate,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000);
    return 0;
}



Re: Undefined symbol, Comile error.. - Konstantinos - 14.02.2012

pawn Код:
#include < a_samp >

// Rest of includes

// Global
new Gate;
// Callbacks
public OnGameModeInit( )
{
    Gate = CreateObject(980,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000); //object(airportgate) (1) //closed gate
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/open", cmdtext, true, 10) == 0)
    {
        CreateObject(980,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000); //object(airportgate) (1)
        MoveObject(Gate,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000);
        return 1;
    }
    return 0;
}
If you return a value the the MoveObject will not work. Also, Gate should be Global Variable.


Re: Undefined symbol, Comile error.. - davve95 - 14.02.2012

Still same errors...


Re: Undefined symbol, Comile error.. - Konstantinos - 14.02.2012

pawn Код:
#include < a_samp >

new Gate;

public OnGameModeInit( )
{
    Gate = CreateObject( 980, -967.79998779, 2715.10009766, 52.29999924, 0.00000000, 0.00000000, 277.50000000 ); //object(airportgate) (1) //closed gate
    return 1;
}

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( !strcmp( cmdtext, "/open", true ) )
    {
        MoveObject( Gate, -967.79998779, 2715.10009766, 52.29999924, 0.00000000, 0.00000000, 277.50000000 );
        return 1;
    }
    return 0;
}
pawn Код:
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase



Re: Undefined symbol, Comile error.. - ViruZz - 14.02.2012

pawn Код:
CreateObject(980,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000); //object(airportgate) (1)
        return 1;
    }   MoveObject(Gate,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000);
    return 0;
To explain what happened you are creating the gate twice. The gate is already created when the Gamemode Initialize so why will you create it again in your CMD?

So for your CMD Use this

pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( !strcmp( cmdtext, "/open", true ) )
    {
        MoveObject( Gate, -967.79998779, 2715.10009766, 52.29999924, 0.00000000, 0.00000000, 277.50000000 );
        return 1;
    }
    return 0;
}



Re: Undefined symbol, Comile error.. - System64 - 14.02.2012

just add it on top of your script, after all includes and defines


Re: Undefined symbol, Comile error.. - davve95 - 14.02.2012

Okay, Thanks alot!! .


Re: Undefined symbol, Comile error.. - davve95 - 14.02.2012

Quote:
Originally Posted by ViruZz
Посмотреть сообщение
pawn Код:
CreateObject(980,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000); //object(airportgate) (1)
        return 1;
    }   MoveObject(Gate,-967.79998779,2715.10009766,52.29999924,0.00000000,0.00000000,277.50000000);
    return 0;
To explain what happened you are creating the gate twice. The gate is already created when the Gamemode Initialize so why will you create it again in your CMD?

So for your CMD Use this

pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( !strcmp( cmdtext, "/open", true ) )
    {
        MoveObject( Gate, -967.79998779, 2715.10009766, 52.29999924, 0.00000000, 0.00000000, 277.50000000 );
        return 1;
    }
    return 0;
}
Because I need a command to open?


Re: Undefined symbol, Comile error.. - Konstantinos - 14.02.2012

@davve
You already created the object OnGameModeInit Callback. All you have to do is to MoveObject by a command and not create again the object


Re: Undefined symbol, Comile error.. - davve95 - 15.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
@davve
You already created the object OnGameModeInit Callback. All you have to do is to MoveObject by a command and not create again the object
Ok! Thanks alot I see now! thanks!.