Problems With Command
#1

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?
Reply
#2

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;
    }
}
Reply
#3

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.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)