Help with /enter /exit - 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: Help with /enter /exit (
/showthread.php?tid=439873)
Help with /enter /exit -
Dare Devil..... - 27.05.2013
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
AW: Help with /enter /exit -
Harry :) - 27.05.2013
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".
Re: Help with /enter /exit -
PT - 27.05.2013
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;
}