SA-MP Forums Archive
/exit not working. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /exit not working. (/showthread.php?tid=296877)



/exit not working. - TheTerminator - 13.11.2011

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!


Re: /exit not working. - wumpyc - 13.11.2011

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


Re: /exit not working. - TheTerminator - 13.11.2011

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' --''


Re: /exit not working. - wumpyc - 13.11.2011

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;




Re: /exit not working. - KosmasRego - 13.11.2011

The last return 1; is return 0;


Re: /exit not working. - TheTerminator - 13.11.2011

error 010: invalid function or declaration 3x this error :O


Re: /exit not working. - Kwarde - 13.11.2011

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;
    }



Re: /exit not working. - wumpyc - 13.11.2011

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.


Re: /exit not working. - TheTerminator - 13.11.2011

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;
}



Re: /exit not working. - antonio112 - 13.11.2011

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;
    }