SA-MP Forums Archive
exit command - 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 command (/showthread.php?tid=501592)



exit command - vassilis - 19.03.2014

Hello lads so here is my exit command which as i realised its not pretty efficient..
pawn Код:
CMD:exit(playerid,params[])
{
    #pragma unused params
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 1456.424682, -987.705749, 996.105041)) return SendClientMessage(playerid,-1,""COL_RED"ERROR"COL_WHITE":You have to be near the exit point to exit LS BANK!");
    {
    SetPlayerPos(playerid,1791.145019 +2, -1777.106567 +2, 13.544099 +1);
    }
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 1474.0437, -1751.1372, 3285.2859)) return SendClientMessage(playerid,-1,""COL_RED"ERROR"COL_WHITE":You have to be near the exit point to exit LSPD!");
    {
    SetPlayerPos(playerid,1554.307495 -2, -1675.323852 -1, 15.770359);
    }
    return 1;
}
But anyway the problem is that when i try to exit LSPD it says you are not near the exit point of LS BANK
So how i could make it for each position certainly??


Re: exit command - MP2 - 19.03.2014

Your if() structure is completely wrong.

pawn Код:
CMD:exit(playerid, params[])
{
    #pragma unused params
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 1456.424682, -987.705749, 996.105041)) // LS Bank
    {
        SetPlayerPos(playerid, 1791.145019 +2, -1777.106567 +2, 13.544099 +1);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, 1474.0437, -1751.1372, 3285.2859)) // LSPD
    {
        SetPlayerPos(playerid, 1554.307495 -2, -1675.323852 -1, 15.770359);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "ERROR"COL_WHITE": You are not near an exit point.");
    }
    return 1;
}
Also, always put a space after commas, it helps make your code clearer to read.
Also, this line:

pawn Код:
SendClientMessage(playerid,-1,""COL_RED"ERROR"COL_WHITE":You have to be near the exit point to exit LSPD!");
You're wasting character space by using colour embedding at the start. Remove that and just set the colour message to red.


Re: exit command - azzerking - 19.03.2014

1st make sure the cordinates are correct, 2nd try increasing the radius from 2.0 to 5.0 and try again


Re: exit command - vassilis - 19.03.2014

Quote:
Originally Posted by MP2
Посмотреть сообщение
Your if() structure is completely wrong.

pawn Код:
CMD:exit(playerid, params[])
{
    #pragma unused params
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 1456.424682, -987.705749, 996.105041)) // LS Bank
    {
        SetPlayerPos(playerid, 1791.145019 +2, -1777.106567 +2, 13.544099 +1);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, 1474.0437, -1751.1372, 3285.2859)) // LSPD
    {
        SetPlayerPos(playerid, 1554.307495 -2, -1675.323852 -1, 15.770359);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "ERROR"COL_WHITE": You are not near an exit point.");
    }
    return 1;
}
Also, always put a space after commas, it helps make your code clearer to read.
Also, this line:

pawn Код:
SendClientMessage(playerid,-1,""COL_RED"ERROR"COL_WHITE":You have to be near the exit point to exit LSPD!");
You're wasting character space by using colour embedding at the start. Remove that and just set the colour message to red.
Ye indeed i changed it to isplayerinrange of point and i will set an else at the bottom thats what i thought 2 minutes before implemented and worked just forgot to edit the post to [solved] thanks anyway mp2