A problem with PlayerToPoint
#1

Hello, I'm completely new into scripting, and couldn't find help to this issue on the web. So I decided to post here.

I'm trying to make an /enter command, which works only in one place, for each teleport destination.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])

  if(strcmp(cmdtext, "/enter", true) == 0) // BANK
  {
    if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.8438)); // <-- Line 75
  }
  {
  SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);
  }
}
And when compiling that, I get one error:
pawn Код:
test.pwn(75) : error 036: empty statement

I know this might sound stupid, and the solution is probably a simple one, but I couldn't simply get the solution myself.
Reply
#2

You forget to add
return 1;
}
Reply
#3

Quote:
Originally Posted by [GTA
Deadly_Evil ]
You forget to add
return 1;
}
Dumb question coming up; Where?
Reply
#4

Код:
public OnPlayerCommandText(playerid, cmdtext[])
  if(strcmp(cmdtext, "/enter", true) == 0) // BANK
  {
    if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.8438)); // <-- Line 75
//  } 
  {
  SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);
  }
return 1;
}
You had a { too much, and I've added the 'return 1;' too
Reply
#5

With:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])            // <-- Line 70
  if(strcmp(cmdtext, "/enter", true) == 0) // BANK           <-- Line 71
  {
    if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.8438)); // <-- Line 73
  }
  {
    SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);  // <-- Line 76
  }
return 1;                              // <-- Line 78
}

it gives me two errors:

pawn Код:
C:\Documents and Settings\¤¤¤¤¤¤¤\Desktop\test.pwn(73) : error 036: empty statement
C:\Documents and Settings\¤¤¤¤¤¤¤\Desktop\test.pwn(78) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#6

What is it, Why does everyone use IsPlayerToPoint, Use:

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

Its way way better, I dont know why people still use IsPlayerToPoint
Reply
#7

As I said before, try this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/enter", true) == 0) // BANK
  {
  if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.8438)); // <-- Line 75
  {
  SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);
  } 
  return 1;
}
return 0; // does not take part in the command, just at the call back
} // same as above
Reply
#8

Quote:
Originally Posted by VonLeeuwen
As I said before, try this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/enter", true) == 0) // BANK
  {
  if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.8438)); // <-- Line 75
  {
  SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);
  } 
  return 1;
}
return 0; // does not take part in the command, just at the call back
} // same as above
Quote:
Originally Posted by Torran
What is it, Why does everyone use IsPlayerToPoint, Use:

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

Its way way better, I dont know why people still use IsPlayerToPoint
Reply
#9

I tested IsPlayerInRangeOfPoint and it worked instantly. Thanks for everyones help
Reply
#10

Quote:
Originally Posted by Torran
Quote:
Originally Posted by VonLeeuwen
As I said before, try this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/enter", true) == 0) // BANK
  {
  if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.8438)); // <-- Line 75
  {
  SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);
  } 
  return 1;
}
return 0; // does not take part in the command, just at the call back
} // same as above
Quote:
Originally Posted by Torran
What is it, Why does everyone use IsPlayerToPoint, Use:

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

Its way way better, I dont know why people still use IsPlayerToPoint
I know, I use IsPlayerInRangeOfPOint too, but he decided to use this one... So I tried to help him with it
Reply
#11

And he fixed it.. With IsPlayerInRangeOfPoint XD
Reply
#12

NO!
Since when does an if statement have ;?
if(PlayerToPoint(6.0, playerid, 1462.3953,-1011.4509,26.843);
Reply
#13

Since yesterday, haven't you heard the news?
Reply
#14

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/enter", true) == 0) // BANK
    {
        if(IsPlayerInRangeOfPoint(playerid, 6.0, 1462.3953,-1011.4509,26.8438))
        {
            SetPlayerPos(playerid, 2305.1880,-16.1371,26.7422,278.6509);
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)