Help with /enter /exit
#1

pawn Код:
CMD:enter(playerid, params[])
{
            if(IsPlayerInRangeOfPoint(playerid, 15.0, -2521.0598,-624.7101,132.7834))return SendClientMessage(playerid, COLOR_RED, "You are not near an entrance.");
            {
                SetPlayerPos(playerid,-2240.468505,137.060440,1035.414062);
                SetPlayerInterior(playerid,6);
            }
    return 1;
}
CMD:exit(playerid, params[])
{
            if(IsPlayerInRangeOfPoint(playerid, 15.0, -2240.468505,137.060440,1035.414062))return SendClientMessage(playerid, COLOR_RED, "You are not near an exit");
            {
                SetPlayerPos(playerid,-2521.0598,-624.7101,132.7834);
                SetPlayerInterior(playerid,0);
                return 1;
            }
       
   
    return 1;
}
If I use /enter it is usable anywhere It dont let me use it from the range only and if I am in it gives me an error you are not in range even though I am
Reply
#2

you should add a "!", it's correct like this:

Код:
CMD:enter(playerid, params[])
{
            if(!IsPlayerInRangeOfPoint(playerid, 15.0, -2521.0598,-624.7101,132.7834))return SendClientMessage(playerid, COLOR_RED, "You are not near an entrance.");
            {
                SetPlayerPos(playerid,-2240.468505,137.060440,1035.414062);
                SetPlayerInterior(playerid,6);
            }
    return 1;
}
CMD:exit(playerid, params[])
{
            if(!IsPlayerInRangeOfPoint(playerid, 15.0, -2240.468505,137.060440,1035.414062))return SendClientMessage(playerid, COLOR_RED, "You are not near an exit");
            {
                SetPlayerPos(playerid,-2521.0598,-624.7101,132.7834);
                SetPlayerInterior(playerid,0);
                return 1;
            }
       
   
    return 1;
}
you're checking if a player's in range of the point and if he is you return a failed to exit message and the ! is a "NOT", so now it is "if a player is not in range of the point return Send the error message".
Reply
#3

That is the reason because i prefer this form:

pawn Код:
CMD:enter(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 15.0, -2521.0598,-624.7101,132.7834))
    {
        SetPlayerPos(playerid,-2240.468505,137.060440,1035.414062);
        SetPlayerInterior(playerid,6);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You are not near an entrance.");
    }
    return 1;
}

CMD:exit(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 15.0, -2240.468505,137.060440,1035.414062))
    {
        SetPlayerPos(playerid,-2521.0598,-624.7101,132.7834);
        SetPlayerInterior(playerid,0);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You are not near an exit");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)