Why doesnt command work? - 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: Why doesnt command work? (
/showthread.php?tid=361140)
Why doesnt command work? -
oblexive - 20.07.2012
Код:
CMD:activatetrucker(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "INFO: You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "INFO: You are not authorized to use this command.");
new Float:X, Float:Y, Float:Z; //We use this to store player position
GetPlayerPos(playerid, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
if (X >= -466 && X <= -505 && Y >= -468 && Y <= -507)
{
SendClientMessage(playerid, COLOR_YELLOW, "Success!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Failed!");
}
return 1;
}
Its a test for me to get areas working, how the heck do I do it though? Its not working. This is supposed to be an area just north of the truck depot west of LS.
Also, How do I post my code in pawno here on the forum. Thanks heaps guys!
Re: Why doesnt command work? -
newbienoob - 20.07.2012
pawn Код:
if (X >= -466 && X <= -505 && Y >= -468 && Y <= -507)
// o.O
// Use IsPlayerInRangeOfPoint
By the way, use [pawn ] [/pawn]
Re: Why doesnt command work? -
oblexive - 20.07.2012
Thanks for the quick reply dude. Ill checkout IsPlayerInRangeOfPoint. It seems straightforward. Cheers for both.
... wtf. Im hell stupid thanks man..
Re: Why doesnt command work? -
oblexive - 20.07.2012
although there is isplayerinrange, is there still a way to get wether the player is within a box area?
Re: Why doesnt command work? -
newbienoob - 20.07.2012
Get streamer plugin
pawn Код:
native CreateDynamicRectangle();
then use
public OnPlayerEnterArea
Re: Why doesnt command work? -
oblexive - 21.07.2012
Cool thanks for that, I use the streamer for checkpoints and stuff but ill look into it. Thanks alot
Re: Why doesnt command work? -
MadeMan - 21.07.2012
X must be bigger than min X and smaller than max X
min X: -505
max X: -466
same with Y
pawn Код:
if (X >= -505 && X <= -466 && Y >= -507 && Y <= -468)