Cmd problems
#1

ok, so i created a gate for my admin base and it wouldn't open on cmd https://sampforum.blast.hk/showthread.php?tid=202906
so i went and downloaded this whole filterscript base http://forum.sa-mp.com/showthread.ph...ght=admin+gate
and those cmds had no effect also.

i have created a gate that opens successfully from the wiki, but now i want one that either opens on cmd or for admins only.
also it would be nice to know what the problem is above.
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/aopen", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
         MoveObject(admingate, 1010.09375, 1844.1826171875, 15.902549743652, 2.0);// Last number is speed
         SendClientMessage(playerid, COLOR_RED, "The gate is open");
         return 1;
      }
    }

     if(strcmp(cmdtext, "/aclose", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
        MoveObject(admingate, 1010.09375, 1844.1826171875, 11.402549743652, 2.0);
        SendClientMessage(playerid, COLOR_RED, "The Gate Is closed Now");
        return 1;
     }
    }
Command only works if the player is logged into RCON.
Reply
#3

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(251) : error 028: invalid subscript (not an array or too many subscripts): "IsPlayerAdmin"
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(256) : warning 209: function "OnPlayerCommandText" should return a value
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(258) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(260) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(264) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(267) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(669) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
?
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp(cmdtext, "/aopen", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
         MoveObject(admingate, 1010.09375, 1844.1826171875, 15.902549743652, 2.0);// Last number is speed
         SendClientMessage(playerid, COLOR_RED, "The gate is open");
         return 1;
      }
    }

     if(strcmp(cmdtext, "/aclose", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
        MoveObject(admingate, 1010.09375, 1844.1826171875, 11.402549743652, 2.0);
        SendClientMessage(playerid, COLOR_RED, "The Gate Is closed Now");
        return 1;
     }
    }
    return 0;
}
Reply
#5

Quote:
Originally Posted by R16RACA
Посмотреть сообщение
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(251) : error 028: invalid subscript (not an array or too many subscripts): "IsPlayerAdmin"
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(256) : warning 209: function "OnPlayerCommandText" should return a value
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(258) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(260) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(264) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(267) : error 010: invalid function or declaration
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(669) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
?
Post the code.

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sampserver0.3c\gamemodes\lvdm.pwn(256) : warning 209: function "OnPlayerCommandText" should return a value
Put return 0; before the last bracket in OnPlayerCommandText()
Reply
#6

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp(cmdtext, "/aopen", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
         MoveObject(admingate, 1010.09375, 1844.1826171875, 15.902549743652, 2.0);// Last number is speed
         SendClientMessage(playerid, COLOR_RED, "The gate is open");
         return 1;
      }
    }

     if(strcmp(cmdtext, "/aclose", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
        MoveObject(admingate, 1010.09375, 1844.1826171875, 11.402549743652, 2.0);
        SendClientMessage(playerid, COLOR_RED, "The Gate Is closed Now");
        return 1;
     }
    }
    return 0;
}
i put this code in (and yes i had return 0 already), compiles fine, but i login to rcon, type/aopen next to the gate, and it still doesnt open

Quote:

Post the code.

_Raped im using the code above my post, i thought thats obvious.
Reply
#7

Use Code not quote. quote is hard to read.
Reply
#8

Do you have the gate created?
Reply
#9

Код:
admingate = CreateObject (7657, 1010.09375, 1844.1826171875, 11.402549743652, 0, 0, 179.99450683594); //gate
and yes, its in the right place
Код:
public OnGameModeInit()
{
Reply
#10

Everything is right. I just tested it, and it work's perfectly fine. If you want I'll upload mine to pastebin.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)