01.03.2011, 21:23
Well your code needs some serious indentation, it's already becoming hard to read and it's only a few lines long! Also your usage of SetPlayerPos is wrong, you're setting the position of player 264.78? That doesn't make sense, look at my example:
So then you're passing the playerid of the person that typed the command which is available in this callback, do you see what I mean?
You can keep using the shorthand if statement in this case, but I recommend using brackets to again make it structurally easier to read, like so:
Additionally if you want to change the players angle, you need to use SetPlayerFacingAngle, as SetPlayerPos only accepts the X Y Z co-ordinates.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/enter",cmdtext))
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2935.96, 1842.19, 15.80))
{
SetPlayerPos(playerid, 264.78, 77.62, 1001.04);
return 1;
}
return 0;
}
You can keep using the shorthand if statement in this case, but I recommend using brackets to again make it structurally easier to read, like so:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/enter",cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2935.96, 1842.19, 15.80))
{
SetPlayerPos(playerid, 264.78, 77.62, 1001.04);
}
return 1;
}
return 0;
}