08.07.2011, 18:41
i know how to make agate open whie you press akey but i need from you help how to make the gate close in the same key help
if(gate==0)
{
gate = 1;
MoveObject(gatename, 1588.965698, -1637.882690, 7.710285, 1.50);
}
else if(gate==1)
{
gate= 0;
MoveObject(gatename, 1588.965698, -1637.882690, 15.260185, 1.50);
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { return 1; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_SPRINT) // Sprint key, when you want you character run faster { if(gate==0) { gate = 1; MoveObject(gatename, 1588.965698, -1637.882690, 7.710285, 1.50); } else if(gate==1) { gate= 0; MoveObject(gatename, 1588.965698, -1637.882690, 15.260185, 1.50); } } return 1; }
new bool:namewhateveryouwant;
if(newkeys & your key)
{
if(IsPlayerInRangeOfPoint(.....)) // If you want that a player could only open/close the gate if he's close to your desired position.
{
if(namewhateveryouwant== false) // if the gate is closed. By default, the namewhateveryouwant bool will be false when the server starts.
{
MoveObject(........);
namewhateveryouwant = true;
return 1;
}
else
{
MoveObject(......);
namewhateveryouwant = false;
return 1;
}
}
}