Command issue
#1

Well.. I have abseloutely no idea what went wrong.. I just entered a simple /enter cmd, yet it doesn't work.. Also I can't find the problem with line 385(/mdelevator). There is a loose indentation, can't find it.. But here it is:
pawn Код:
}
if (strcmp("/mdelevator", cmdtext, true, 10) == 0)
    {
    if (PlayerToPoint(26, playerid,1148.358032,-1315.570678,24.000000))
    if(MDElevatorstatus)
    {
        MoveObject(MDElevator, 1148.358032,-1315.570678,31.79 , 2);
        MDElevatorstatus = 0;
    }
    else
    {
        MoveObject(MDElevator, 1148.358032,-1315.570678,14 , 2);
        MDElevatorstatus = 1;
    }
    return 1;
}

if (strcmp("/enter", cmdtext, true, 10) == 0)
{
        if (PlayerToPoint(3.0,playerid,1173.0345,-1323.7742,15.3973))
        {
            SetPlayerPos(playerid,1174.5543,-1310.0366,-4.9240);
           
     }
      return 1;
 }
}
return 0;
}
And line 385 is the /mdelevator cmd:
pawn Код:
C:\Users\Bastian\Documents\Samp_server\gamemodes\FD_Station.pwn(385) : warning 217: loose indentation
Reply
#2

Try this

Код:
}
if (strcmp("/mdelevator", cmdtext, true, 10) == 0)
{
if (PlayerToPoint(26, playerid,1148.358032,-1315.570678,24.000000))
if(MDElevatorstatus)
{
MoveObject(MDElevator, 1148.358032,-1315.570678,31.79 , 2);
MDElevatorstatus = 0;
}
else
{
MoveObject(MDElevator, 1148.358032,-1315.570678,14 , 2);
MDElevatorstatus = 1;
}
return 1;
}

if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if (PlayerToPoint(3.0,playerid,1173.0345,-1323.7742,15.3973))
{
SetPlayerPos(playerid,1174.5543,-1310.0366,-4.9240);

}
return 1;
}
}
return 0;
}
Reply
#3

Didn't change anything.
Here are all my cmds, if that'd help you find the issue:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/fdhangar", cmdtext, true, 10) == 0)
   
  {
   
    if (PlayerToPoint(20, playerid, 1701.0929,-1507.6711,13.3828))
    if(FDGate1status)
    {
       MoveObject(FDGate1, 1700.859375 , -1507.785156 , 14.566914, 1);
       FDGate1status = 0;
    }
    else
    {
      MoveObject(FDGate1, 1700.859375 , -1507.785156 , 8.566914, 1);
      FDGate1status = 1;
    }
    return 1;

 }
if (strcmp("/fdmaingate", cmdtext, true, 10) == 0)

  {
    if (PlayerToPoint(15, playerid, 1679.9694,-1479.9602,13.3828))
    if(FDMaingatestatus)
    {
       MoveObject(FDMaingate, 1680.0 , -1479.0 , 14.0, 1);
       FDMaingatestatus = 0;
    }
    else
    {
      MoveObject(FDMaingate, 1680.0 , -1471.0 , 14.0, 1);
      FDMaingatestatus = 1;
    }
    return 1;
 }
if (strcmp("/fdelevator", cmdtext, true, 10) == 0)

{
    if (PlayerToPoint(20, playerid,1709.761596 , -1465.448852 , 16))
    if(FDElevatorstatus)
    {
       MoveObject(FDElevator, 1709.761596 , -1465.448852 , 33.256496 , 2);
       FDElevatorstatus = 0;
    }
    else
    {
      MoveObject(FDElevator, 1709.761596 , -1465.448852 , 13.812069 , 2);
      FDElevatorstatus = 1;
        }
   
        return 1;
 }

if (strcmp("/mdmaingate", cmdtext, true, 10) == 0)
{
    if (PlayerToPoint(20, playerid,1142.2526,-1289.9144,13.5873))
    if(MDGate1status)

    {
       MoveObject(MDGate1, 1138.368408 , -1290.706909 , 14 , 2);
       MDGate1status = 0;

    }
    else
    {
      MoveObject(MDGate1, 1146.368408 , -1290.706909 , 14 , 2);
      MDGate1status = 1;
            return 1;
 }
if (strcmp("/mdelevator", cmdtext, true, 10) == 0)
    {
    if (PlayerToPoint(26, playerid,1148.358032,-1315.570678,24.000000))
    if(MDElevatorstatus)
    {
        MoveObject(MDElevator, 1148.358032,-1315.570678,31.79 , 2);
        MDElevatorstatus = 0;
    }
    else
    {
        MoveObject(MDElevator, 1148.358032,-1315.570678,14 , 2);
        MDElevatorstatus = 1;
    }
    return 1;
}

if (strcmp("/enter", cmdtext, true, 10) == 0)
{
        if (PlayerToPoint(3.0,playerid,1173.0345,-1323.7742,15.3973))
        {
            SetPlayerPos(playerid,1174.5543,-1310.0366,-4.9240);

        }
      return 1;
}
}
return 0;
}
Reply
#4

Fix your indention style then. Code in the same block should not change indention, thats what the warning tells you.

Try http://dracoblue.net/tidy/pawn/ to properly format this part of your code.

- Draco
Reply
#5

Its just a matter of wrong identation
Reply
#6

Quote:
Originally Posted by Peter Corneile [hugu-hosting.co.uk
]
Its just a matter of wrong identation
Well. What about the /enter code. It's disabled somehow..?
Reply
#7

Quote:
Originally Posted by Shinzei_Banzai
Well. What about the /enter code. It's disabled somehow..?
This: if (strcmp("/enter", cmdtext, true, 10) == 0)
Tests the first 10 characters, for /enter. What will not work.

In general this: if (strcmp("/enter", cmdtext, true) == 0)
will do the trick.

But consider to create your commands with a proper solution like dcmd or the new zcmd.

- Draco
Reply
#8

Very chaotic code

Warning 207 is important, if you want to have legible code
But it doesn't affect correct working of the script (like every warning though)

You can fix indentations or use

pawn Код:
#pragma tabsize 0
...somewhere below your includes, but I don't recommend it
Reply
#9

Quote:
Originally Posted by Sznupek
Very chaotic code

Warning 207 is important, if you want to have legible code
But it doesn't affect correct working of the script (like every warning though)

You can fix indentations or use

pawn Код:
#pragma tabsize 0
...somewhere below your includes, but I don't recommend it
It can be used to solve the warning but its not a very innovative step ...
Reply
#10

Quote:
Originally Posted by Peter Corneile [hugu-hosting.co.uk
It can be used to solve the warning but its not a very innovative step ...
Yes, and it's why I don't recommend it
I prefer making clear and solid code to fixing it with these forced solutions
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)