/exit not working.
#1

So, I made this /exit command, my /enter command is working fine, it TP's me to the interior and the position, when i try to /exit the interior, nothing, not even: "[SERVER]Unknown Command"... I tried everything, browsed *******, this forum, ******, nothing... This is the code:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 384.808624,173.804992,1008.382812));
        SetPlayerPos(playerid, 2302.9736,-53.8796,26.4844);
        SetPlayerInterior(playerid, 0);
        return 1;
    }
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 2302.9736,-53.8796,26.4844))
        SetPlayerPos(playerid, 384.808624,173.804992,1008.382812);
        SetPlayerInterior(playerid, 3);
        return 1;
    }
If anyone has ideas, respond quickly, thanks!
Reply
#2

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/exit"cmdtexttrue10) == 0)
    {
      if(
IsPlayerInRangeOfPoint(playerid1.0384.808624,173.804992,1008.382812));
      
SetPlayerPos(playerid2302.9736,-53.8796,26.4844);
      
SetPlayerInterior(playerid0);
      return 
1;
    }
    if (
strcmp("/enter"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.02302.9736,-53.8796,26.4844))
        
SetPlayerPos(playerid384.808624,173.804992,1008.382812);
        
SetPlayerInterior(playerid3);
        return 
1;
    } 
"if" was mising
Reply
#3

Quote:
Originally Posted by wumpyc
Посмотреть сообщение
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/exit"cmdtexttrue10) == 0)
    {
      if(
IsPlayerInRangeOfPoint(playerid1.0384.808624,173.804992,1008.382812));
      
SetPlayerPos(playerid2302.9736,-53.8796,26.4844);
      
SetPlayerInterior(playerid0);
      return 
1;
    }
    if (
strcmp("/enter"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.02302.9736,-53.8796,26.4844))
        
SetPlayerPos(playerid384.808624,173.804992,1008.382812);
        
SetPlayerInterior(playerid3);
        return 
1;
    } 
"if" was mising
"error 036: empty statement"


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
      if(IsPlayerInRangeOfPoint(playerid, 1.0, 384.808624,173.804992,1008.382812));
      SetPlayerPos(playerid, 2302.9736,-53.8796,26.4844);
      SetPlayerInterior(playerid, 0);
      return 1;
    }
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 2302.9736,-53.8796,26.4844))
        SetPlayerPos(playerid, 384.808624,173.804992,1008.382812);
        SetPlayerInterior(playerid, 3);
        return 1;
    }


EDIT: FIxed that, but still not working I had to remove the ";" from if(IsPlayer...) But yet, it aint workin' --''
Reply
#4

Ok, this should work now...
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/exit"cmdtexttrue10) == 0)
    {
      if(
IsPlayerInRangeOfPoint(playerid1.0384.808624,173.804992,1008.382812))
      {
      
SetPlayerPos(playerid2302.9736,-53.8796,26.4844);
      
SetPlayerInterior(playerid0);
      }
      return 
1;
    }
    if (
strcmp("/enter"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid1.02302.9736,-53.8796,26.4844))
        {
        
SetPlayerPos(playerid384.808624,173.804992,1008.382812);
        
SetPlayerInterior(playerid3);
        }
        return 
1;
    }
    return 
0;

Reply
#5

The last return 1; is return 0;
Reply
#6

error 010: invalid function or declaration 3x this error :O
Reply
#7

First of all: After an 'if' statement you shouldn't add a decilla. That is this one: ;
Secondly: If the command after the statement has more then one lines you should use these brackets: {}
The fixed version is here:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/exit", cmdtext, true, 5) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 384.808624,173.804992,1008.382812))
        {
            SetPlayerPos(playerid, 2302.9736,-53.8796,26.4844);
            SetPlayerInterior(playerid, 0);
        }
        return 1;
    }
    if(strcmp("/enter", cmdtext, true, 6) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 2302.9736,-53.8796,26.4844))
        {
            SetPlayerPos(playerid, 384.808624,173.804992,1008.382812);
            SetPlayerInterior(playerid, 3);
        }
        return 1;
    }
Reply
#8

Quote:
Originally Posted by TheTerminator
Посмотреть сообщение
error 010: invalid function or declaration 3x this error :O
Just copy my last post, i don't get any error.
Reply
#9

I put return 0; and still not working help!


this is the whole code for cmd:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/exit", cmdtext, true, 10) == 0)
    {
      if(IsPlayerInRangeOfPoint(playerid, 1.0, 384.808624,173.804992,1008.382812))
      SetPlayerPos(playerid, 2302.9736,-53.8796,26.4844);
      SetPlayerInterior(playerid, 0);
      return 1;
    }
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 2302.9736,-53.8796,26.4844))
        SetPlayerPos(playerid, 384.808624,173.804992,1008.382812);
        SetPlayerInterior(playerid, 3);
        return 1;
    }
    return 1;
}
    if (strcmp("/teleport", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 2302.9736,-53.8796,26.4844);
        return 1;
    }
    return 0;
}
Reply
#10

You sure you have the correct coordinates? I don't see anything wrong with the command ...

Or, try the next thing:

pawn Код:
if (strcmp("/exit", cmdtext, true, 5) == 0)
    {
      if(IsPlayerInRangeOfPoint(playerid, 1.0, 384.808624,173.804992,1008.382812))
      SetPlayerPos(playerid, 2302.9736,-53.8796,26.4844);
      SetPlayerInterior(playerid, 0);
      return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)