Gate script not working.
#1

Hey. I added a gate in the map, this is the code i added:

First in the script:
Код:
new ahgate
OnPlayerCommandText line:
Код:
ahgate = CreateObject(980,1742.20727539,-1755.67358398,15.28825760,0.00000000,0.00000000,0.00000000); //object(airportgate)
OnPlayerCommandText line:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
    }
    if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
}
return 1;
}
And when i click run, the pawno crash, and in the run window, is it no text. and my .amx gamemode is 0 kb, and .pwn 1899 kb.
I tryed on 2 computers, and i get same thing. no erro, but it wont save. Help?
Reply
#2

Try else in between the commands
Reply
#3

Quote:
Originally Posted by orbison
Посмотреть сообщение
Hey. I added a gate in the map, this is the code i added:

First in the script:
pawn Код:
new ahgate
OnPlayerCommandText line:
pawn Код:
ahgate = CreateObject(980,1742.20727539,-1755.67358398,15.28825760,0.00000000,0.00000000,0.00000000); //object(airportgate)

OnPlayerCommandText line:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
    }
    if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
}
return 1;
}
And when i click run, the pawno crash, and in the run window, is it no text. and my .amx gamemode is 0 kb, and .pwn 1899 kb.
I tryed on 2 computers, and i get same thing. no erro, but it wont save. Help?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
    }
    if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
} // <- Very big error here
return 1;
}
Reply
#4

Now i have some erro,
Код:
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(46) : error 001: expected token: ";", but found "new"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(49) : error 001: expected token: ";", but found "new"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18660) : error 017: undefined symbol "COLOR_BLUE"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18661) : error 017: undefined symbol "Gate1"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18666) : error 017: undefined symbol "COLOR_BLUE"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : error 017: undefined symbol "Gate1"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : error 029: invalid expression, assumed zero
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : warning 215: expression has no effect
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : warning 215: expression has no effect
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : error 001: expected token: ";", but found ")"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.
How to fix it, i tryed, not work.
Reply
#5

Quote:
Originally Posted by orbison
Посмотреть сообщение
Now i have some erro,
Код:
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(46) : error 001: expected token: ";", but found "new"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(49) : error 001: expected token: ";", but found "new"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18660) : error 017: undefined symbol "COLOR_BLUE"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18661) : error 017: undefined symbol "Gate1"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18666) : error 017: undefined symbol "COLOR_BLUE"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : error 017: undefined symbol "Gate1"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : error 029: invalid expression, assumed zero
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : warning 215: expression has no effect
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : warning 215: expression has no effect
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : error 001: expected token: ";", but found ")"
C:\Users\Alex\gm upload\2\gamemodes\GTA-RGRP.pwn(18667) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.
How to fix it, i tryed, not work.
Try mine...!!
Reply
#6

The first thing i tryed:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        else
    }
    if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
}
return 1;
}
not worked, so i tryed this:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
        else
    }
    if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
}
return 1;
}
Please do a code so i know where to add else.
Reply
#7

See like this-
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
        else
    }
   else if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
}
return 1;
}
Reply
#8

Quote:
Originally Posted by orbison
Посмотреть сообщение
Hey. I added a gate in the map, this is the code i added:

First in the script:
Код:
new ahgate
OnPlayerCommandText line:
Код:
ahgate = CreateObject(980,1742.20727539,-1755.67358398,15.28825760,0.00000000,0.00000000,0.00000000); //object(airportgate)
OnPlayerCommandText line:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
    }
    if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
}
return 1;
}
And when i click run, the pawno crash, and in the run window, is it no text. and my .amx gamemode is 0 kb, and .pwn 1899 kb.
I tryed on 2 computers, and i get same thing. no erro, but it wont save. Help?
Ok so first of all your gate is ahgate, and you are trying to move Gate1, so we have to change those. Secondly, its been a while since i used the built in command processor, but i believe you need an else if for the other commands, and the last return 1; should be a return 0; unless you have a message to display.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(ahgate, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
    }
    else if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(ahgate,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }
return 0;
}
that is the fixed code, also for your line at the top with the
Код:
new ahgate
should be
Код:
new ahgate;
Reply
#9

also for your second move object part in the /ahclose command... you have a decimal inside the decimal... may want to check that
Reply
#10

Tryed
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
        else
    }
   else if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }

return 0;
}
And tryed

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/ahopen", true)==0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "The front gate has opened. Welcome Admin!");
        MoveObject(Gate1, 810.798,-1755.6728515625,15.288257598877, 3.0);
        return 1;
        
    }
   else if(strcmp(cmdtext, "/ahclose", true)==0)
    {
      SendClientMessage(playerid, COLOR_BLUE, "The front gate has closed. Goodbye!");
      MoveObject(Gate1,829.798,-1755.6728515625,15.288257598877.690,14.727);
      return 1;
    }

return 0;
}
With
Код:
new ahgate;
But the pawn crashed, and i got no text in the window. Im sure im doing something wrong here
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)