Help with gate
#1

I want my gate to be able to open only when the player is in rang of it.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/gateopen", cmdtext, true, 10) == 0)
	{
		MoveObject(mygate,2705.8347167969, 657.30255126953, 11.070308685303,3.0);
		SendClientMessage(playerid,0xFFFF00FF,"You have just opened the Yard gate");
		return 1;
	}
	if (strcmp("/gateclose", cmdtext, true, 10) == 0)
	{
		MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
		SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
		return 1;
	}
 	else
 	{
 	    SendClientMessage(playerid,0xFF0000FF,"You are too far to open the gate");
 		return 0;
	}
}
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gateopen", cmdtext, true, 10) == 0)
    {
        if (IsPlayerInRangeOfPoint(playerid,4.0,2705.8347167969, 657.30255126953, 11.070308685303))
        {
            MoveObject(mygate,2705.8347167969, 657.30255126953, 11.070308685303,3.0);
            SendClientMessage(playerid,0xFFFF00FF,"You have just opened the Yard gate");
            return 1;
        }
                else return SendClientMessage(playerid, 0xFFFF00FF, "You are not in range of point");
    }
    if (strcmp("/gateclose", cmdtext, true, 10) == 0)
    {
        if (IsPlayerInRangeOfPoint(playerid,4.0,2706.0078125, 652.048828125, 11.070308685303))
        {
            MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
            SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
            return 1;
        }
             else return SendClientMessage(playerid, 0xFFFF00FF, "You are not in range of point");
    }
}
It should work
Reply
#3

Use if( IsPlayerInRangeOfPoint(playerid,range,pos X,pos Y,pos Z) ) before of MoveObjects.
Reply
#4

I got error 017: undefined symbol "PlayerToPointStripped"
Reply
#5

Anybody plz help
Reply
#6

I can't find any PlayerToPointStripped in the code supplied ...

[This forum requires that you wait 120 seconds between posts. Please try again in 11 seconds.] - Dumb.
Reply
#7

Quote:
Originally Posted by zack3021
Посмотреть сообщение
Anybody plz help
Ther user mmrk did upload with the IsPlayerInRangeOfPoint function.
Reply
#8

NVM i fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)