[QUESTION]
#1

First: I wanna know how I can make a command work in only the X, Y, Z coordinates I set it to.
Second: I wanna set commands only in a certain area I select, or maybe the whole area of a shop? once I can make shops I will need this feature so first things first, what do I do now? (Regarding the first question)

-----------------------------------------------------------------------------------------

What you said did help, but I've hit another problem with this code. Help?
I Think I'm Doing Something Wrong, Can Anyone Correct The Code For Me?

My Code:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/enter, true))	{
	{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 1154.5475, -1457.7513, 15.7969))
	{
	SetPlayerPos(playerid, -25.884498,-185.868988,1003.546875);
	{
	SendClientMessage(playerid, 0xFFFFFFFF, "You Are Not Outside A 24/7");
{
	return 1;
}
The Errors I Get:
Code:
D:\khubb2\Desktop\SAMP\Blank Server\gamemodes\PROJECT.pwn(137) : warning 217: loose indentation
D:\khubb2\Desktop\SAMP\Blank Server\gamemodes\PROJECT.pwn(140) : error 030: compound statement not closed at the end of file (started at line 136)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
-------------------------------------------------------------------------------------------------------

See Page 2+ For My New Errors I Need Help With, THANKS!
Reply
#2

IsPlayerInRangeOfPoint

About this?
Reply
#3

read wiki, it will surely help.
Reply
#4

Hmm, could someone give me an example? What I'm trying isnt working.
Reply
#5

pawn Code:
CMD:checktest(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, /* Replace your coordinates */))
    {
          //codes here
    }
    else
    {
         //else if player is not in the area
    }
    return 1;
}
Reply
#6

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext,"/example"))
    {
        new Float:p_Pos[3]; GetPlayerPos(playerid,p_Pos[0],p_Pos[1],p_Pos[2]);
        if( (p_Pos[0] == /* The X pos*/) && (p_Pos[1] == /*The Y pos*/) && (p_Pos[2] == /*The Z pos*/) )
        {
            //Command applys here.
        }
        else SendClientMessage(playerid,-1,"You're not in the correct positions!");
        return 1;
    }
    return 0;
}
But to be in the exact position you need to be pretty damn accurate.
Reply
#7

For example a command using zcmd.

pawn Code:
CMD:buycrack(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid,2.0, x, y, z) ) // Your coordinates
    {
        SendClientMessage(playerid, "You have purchased a bag of crack.");
    }
    return 1;
}
Reply
#8

thanks for the help guys
Reply
#9

I Think I'm Doing Something Wrong, Can Anyone Correct The Code For Me?

My Code:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/enter, true))	{
	{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 1154.5475, -1457.7513, 15.7969))
	{
	SetPlayerPos(playerid, -25.884498,-185.868988,1003.546875);
	{
	SendClientMessage(playerid, 0xFFFFFFFF, "You Are Not Outside A 24/7");
{
	return 1;
}
The Errors I Get:
Code:
D:\khubb2\Desktop\SAMP\Blank Server\gamemodes\PROJECT.pwn(137) : warning 217: loose indentation
D:\khubb2\Desktop\SAMP\Blank Server\gamemodes\PROJECT.pwn(140) : error 030: compound statement not closed at the end of file (started at line 136)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

Yeah, your syntax is wrong.
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/enter", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, 1154.5475, -1457.7513, 15.7969))
        {
            SetPlayerPos(playerid, -25.884498,-185.868988,1003.546875);
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "You Are Not Outside A 24/7");
        }
        return 1;
    }
}
Notice the { }!
Also notice that you've used "/enter" and not "/enter in the command name.

Quote:
Originally Posted by [XST]O_x
View Post
pawn Code:
...
But to be in the exact position you need to be pretty damn accurate.
Almost impossible, pointless to try.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)