Problems With 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: Problems With Command (
/showthread.php?tid=504655)
Problems With Command -
codac3 - 05.04.2014
Alright, hey there. I'm having some problems with creating a test command which displays text when used /test near it's location. Now, it's works perfectly fine. I've set it so it has two different messages when near a specific position, and when you're not. The problem I'm having with it though, is whenever I go even far away from where I set the command to be used it, it still displays the same text as if the player was near the set position. Currently using ZCMD for creating commands.
Код:
CMD:test(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,1092.6321,1077.4729,10.8359,129.3716))
{
SendClientMessage(playerid,0xFFFFFFFF,"Test");
return 1;
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"Nope!");
return 1;
}
}
Any idea how I could fix the problem?
Re: Problems With Command -
Abagail - 05.04.2014
Your flaw is within the IsPlayerInRangeOfPoint. Your missing a huge param with the actual usage of the function. You just put the x, y, z of the points, and not the range that it's gonna detect. That would cause problem's with the command. So, basically you'd do this instead:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,30.0,1092.6321,1077.4729,10.8359,129.3716))
Just change the "30.0" to the range you want them to be from your point. I recommend making it smaller as 30.0 is quite a large range for this kind of thing...
pawn Код:
CMD:test(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,30.0,1092.6321,1077.4729,10.8359,129.3716))
{
SendClientMessage(playerid,0xFFFFFFFF,"Test");
return 1;
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"Nope!");
return 1;
}
}
Re: Problems With Command -
Dokins - 05.04.2014
pawn Код:
CMD:test(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,5.0,1092.6321,1077.4729,10.8359,129.3716))
{
SendClientMessage(playerid,0xFFFFFFFF,"Test");
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"Nope!");
}
return 1;
}
Beat me to it! Aha.
Re: Problems With Command -
codac3 - 05.04.2014
Ah. Thanks a lot, I appreciate the help! I'm sorta new to scripting. I moved fairly far away and when it showed "Test" still, I figured it was a bug and I wasn't sure on what the cause was.