Errors when compiling moving gate
#1

What is wrong with this script?
PHP код:
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
#include <zcmd>
new mcleod;
mcleod Gate CreateObject(9692464.1450195313, -1663.385986328112.30468750087.912261962891); // Closed Gate
public OnPlayerCommandText();
if(
strcmp(cmd"/mcleodgateopen"true) == 0) { // Edit the /eup to your elevator command.
MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
SendClientMessage(playeridCOLOR_RED"The gate is opening."); // You dont alwas have to put this in, delete if wanted.
return 1;
}
if(
strcmp(cmd"/mcleodgateclose"true) == 0) { // Same deal as before
MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875.-2.00); // Same deal as before
SendClientMessage(playeridCOLOR_RED"The gate is closing."); // Same deal as before
return 1;
}
#endif 
I get these errors:
PHP код:
C:\Users\Thomas\Desktop\gates.pwn(11) : error 010invalid function or declaration
C
:\Users\Thomas\Desktop\gates.pwn(15) : error 010invalid function or declaration
C
:\Users\Thomas\Desktop\gates.pwn(18) : error 010invalid function or declaration
C
:\Users\Thomas\Desktop\gates.pwn(20) : error 010invalid function or declaration
C
:\Users\Thomas\Desktop\gates.pwn(23) : error 010invalid function or declaration
C
:\Users\Thomas\Desktop\gates.pwn(26) : warning 203symbol is never used"mcleod"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
5 Errors

Reply
#2

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <zcmd>


new mcleod;
mcleod = Gate = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/mcleodgateopen", true) == 0) { // Edit the /eup to your elevator command.
MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
SendClientMessage(playerid, COLOR_RED, "The gate is opening."); // You dont alwas have to put this in, delete if wanted.
return 1;
}
if(strcmp(cmd, "/mcleodgateclose", true) == 0) { // Same deal as before
MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875.-2.00); // Same deal as before
SendClientMessage(playerid, COLOR_RED, "The gate is closing."); // Same deal as before
return 1;
}
return 0;
}
#endif
What about opening and closing the OnPlayerCommandText brackets ? And also, what about it's arguments ?
Reply
#3

Now I get these errors:
PHP код:
C:\Users\Thomas\Desktop\gates.pwn(11) : error 010invalid function or declaration
C
:\Users\Thomas\Desktop\gates.pwn(15) : error 017undefined symbol "cmd"
C:\Users\Thomas\Desktop\gates.pwn(17) : error 017undefined symbol "playerid"
C:\Users\Thomas\Desktop\gates.pwn(20) : error 017undefined symbol "cmd"
C:\Users\Thomas\Desktop\gates.pwn(22) : error 017undefined symbol "playerid"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


5 Errors

Reply
#4

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <zcmd>

new mcleod;
mcleod = Gate = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mcleodgateopen", cmdtext, true, 10) == 0)
    {
        MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
        SendClientMessage(playerid, COLOR_RED, "The gate is opening."); // You dont alwas have to put this in, delete if wanted.
        return 1;
    }
    if (strcmp("/mcleodgateclose", cmdtext, true, 10) == 0)
    {
        MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875.-2.00); // Same deal as before
        SendClientMessage(playerid, COLOR_RED, "The gate is closing."); // Same deal as before
        return 1;
    }
    return 0;
}
#endif
Reply
#5

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <zcmd>


new mcleod;
mcleod = Gate = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/mcleodgateopen", true) == 0) { // Edit the /eup to your elevator command.
MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
SendClientMessage(playerid, COLOR_RED, "The gate is opening."); // You dont alwas have to put this in, delete if wanted.
return 1;
}
if(strcmp(cmdtext, "/mcleodgateclose", true) == 0) { // Same deal as before
MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875.-2.00); // Same deal as before
SendClientMessage(playerid, COLOR_RED, "The gate is closing."); // Same deal as before
return 1;
}
return 0;
}
#endif
Btw, i don't know if u did it coz its new in 0.3d (i didnt test it out yet)
but why is the Gate thing down here..
mcleod = Gate = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate
Reply
#6

pawn Код:
#include <a_samp>
#include <zcmd>

new
    mcleod;

public OnFilterScriptInit()
{
    mcleod = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/mcleodgateopen", true) == 0)
    {
        MoveObject(mcleod, 2463.7080078125, -1673.7354736327, 12.3046875, 2.00); // moving gate
        SendClientMessage(playerid, -1, "The gate is opening."); // You dont alwas have to put this in, delete if wanted.
        return 1;
    }
    if(strcmp(cmdtext, "/mcleodgateclose", true) == 0) // Same deal as before
    {
        MoveObject(mcleod, 2464.1450195313, -1663.3859863281, 12.3046875, -2.00);
        SendClientMessage(playerid, -1, "The gate is closing."); // Same deal as before
        return 1;
    }
    return 0;
}
Edit: Users above were faster, but both fail. Look better at the code the next time.
pawn Код:
MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875.-2.00);
Instead of
pawn Код:
12.3046875, -2.00);
has a dot "."
pawn Код:
12.3046875.-2.00);
Reply
#7

There were some mistakes with the object co-ords.
New code with the real co-ords:
PHP код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <zcmd>

new mcleod;
mcleod Gate CreateObject(9692464.1450195313, -1663.385986328112.30468750087.912261962891); // Closed Gate

public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mcleodgateopen"cmdtexttrue10) == 0)
    {
        
MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
        
return 1;
    }
    if (
strcmp("/mcleodgateclose"cmdtexttrue10) == 0)
    {
        
MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875,-2.00); // Same deal as before
        
return 1;
    }
    return 
0;
}
#endif 
I have one error left.
PHP код:
C:\Users\Thomas\Desktop\gates.pwn(14) : error 010invalid function or declaration 
Reply
#8

You should have the function CreateObject on OnFilterScriptInit() or OnGameModeInit() (If you were using it for GM.)
This should work.
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <zcmd>

new
    mcleod;

public OnFilterScriptInit()
{
    mcleod = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mcleodgateopen", cmdtext, true, 10) == 0) {
        MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
        return 1;
    }
    if (strcmp("/mcleodgateclose", cmdtext, true, 10) == 0) {
        MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875,-2.00); // Same deal as before
        return 1;
    }
    return 0;
}
#endif
Reply
#9

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
You should have the function CreateObject on OnFilterScriptInit() or OnGameModeInit() (If you were using it for GM.)
This should work.
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <zcmd>

new
    mcleod;

public OnFilterScriptInit()
{
    mcleod = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mcleodgateopen", cmdtext, true, 10) == 0) {
        MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
        return 1;
    }
    if (strcmp("/mcleodgateclose", cmdtext, true, 10) == 0) {
        MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875,-2.00); // Same deal as before
        return 1;
    }
    return 0;
}
#endif
Thanks alot, it works with no warnings or errors
Reply
#10

Not sure if any of you actually saw, but he is using ZCMD with STRCMP.

Just delete the #include <zcmd>
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

//#include <zcmd>

new mcleod;
mcleod = Gate = CreateObject(969, 2464.1450195313, -1663.3859863281, 12.3046875, 0, 0, 87.912261962891); // Closed Gate

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mcleodgateopen", cmdtext, true, 10) == 0)
    {
        MoveObject(mcleod,2463.7080078125,-1673.7354736327,12.3046875,2.00); // moving gate
        return 1;
    }
    if (strcmp("/mcleodgateclose", cmdtext, true, 10) == 0)
    {
        MoveObject(mcleod,2464.1450195313,-1663.3859863281,12.3046875,-2.00); // Same deal as before
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)