27.04.2013, 17:46
This is general kind of syntax of how to create a gate. I have added the comments so you know what is going on. Change the X, Y, Z and Speed of your choice.
pawn Код:
// You should have some variable which creates the gate. I have given a sample as Gate1
new Gate1 = CreateObject(objectid, X, Y, Z); // Variable Gate1 has given value of creating a gate.
if (strcmp("/opengate", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, X, Y, Z)) // the range till where player can use this command.
{
MoveObject(Gate1, X, Y, Z, Speed); // Move the object to where it looks it's opened.
SendClientMessage(playerid, 0xFAFAFAAA, "Gate opened");
return 1;
}
}
if (strcmp("/closegate", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, X, Y, Z))
{
MoveObject(Gate1,X, Y, Z, Speed); //You will need to paste same coords as you make for Gate1 value.
SendClientMessage(playerid, COLOR_GREEN, "Gate closed");
return 1;
}
return 1;
}