SA-MP Forums Archive
/pass - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /pass (/showthread.php?tid=266859)



/pass - Karl1195 - 06.07.2011

Can some one help me to do /pass cause i wasn't able to do it. This is my script i got 26 errors:


Код:
    if(strcmp(cmd, "/pass", true) == 0)
	}
		if(IsPlayerConnected(playerid))
		{
			if(!IsPlayerInRangeOfPoint(playerid,5,1450.8146,-1024.9728,2066.6331))
			{
			    SetPlayerPos(playerid, 1447.4244,-1023.3749,2054.1021);
			}
			SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
			SetPlayerInterior(playerid,0);
			PlayerInfo[playerid][pInt] = 0;

			else
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   You are not at the bank vault !");
			}
		}
		return 1;
 	{
Thanks for the help =]
Karl1195


Re: /pass - Mauzen - 06.07.2011

You messed up the {} brackets, recheck them.
Additionally, else have to follow directly after the if-lines, but you got lines between it.

This way it should work:
pawn Код:
if(strcmp(cmd, "/pass", true) == 0)
    { // opening bracket instead of closing it.
        if(IsPlayerConnected(playerid))
        {
            if(!IsPlayerInRangeOfPoint(playerid,5,1450.8146,-1024.9728,2066.6331))
            {
                SetPlayerPos(playerid, 1447.4244,-1023.3749,2054.1021);
                // These lines belong in this code block, so they are only executed when the if condition is true
                SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                SetPlayerInterior(playerid,0);
                PlayerInfo[playerid][pInt] = 0;
            } else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not at the bank vault !");
            }
        }
        return 1;
    } // close bracket, instead of opening it



Re: /pass - SmileyForCheat - 06.07.2011

You Wrong { should}
pawn Код:
if(strcmp(cmd, "/pass", true) == 0)
    }
        if(IsPlayerConnected(playerid))
        {
            if(!IsPlayerInRangeOfPoint(playerid,5,1450.8146,-1024.9728,2066.6331))
            {
                SetPlayerPos(playerid, 1447.4244,-1023.3749,2054.1021);
            }
            SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
            SetPlayerInterior(playerid,0);
            PlayerInfo[playerid][pInt] = 0;

            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not at the bank vault !");
            }
        }
        return 1;
    }



Re: /pass - Karl1195 - 06.07.2011

Thanks a lot =]


Re: /pass - Karl1195 - 06.07.2011

It does compile but in the script when i do /pass it says i am not at the bank vault and if i am not near it and i do /pass it does teleport me cause this is kinda taken from a teleportation.


Re: /pass - Laronic - 06.07.2011

pawn Код:
if(strcmp(cmd, "/pass", true) == 0)
    }
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid,5,1450.8146,-1024.9728,2066.6331))
            {
                SetPlayerPos(playerid, 1447.4244,-1023.3749,2054.1021);
                SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported !");
                SetPlayerInterior(playerid,0);
                PlayerInfo[playerid][pInt] = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not at the bank vault !");
            }
        }
        return 1;
    }
Edit: Forgot something.