31.05.2011, 17:15
This is working
pawn Код:
new Opened = 0; //Start of the script, under include and defines
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) //Outside any function or other callback
{
if(newkeys == KEY_SUBMISSION) //if the new keys are KEY_SUBMISSION (Mouse Cen)
{
if(IsPlayerInRangeOfPoint(playerid, 150000.0, -1395.03, 2850.07, 95.78)) //If the player is in range of that point
{
if(!Opened) //If is not opened
{
MoveObject (AdminGate, -1395.03, 2850.07, 101.43, 3);//Move the object
SendClientMessage(playerid, COLOR_RED, "Welcome to heaven");//Send the message
Opened = true; //Set variable "Opened" to true, so the server will know it's opened
}
else //Else
{
MoveObject (AdminGate, -1395.03, 2850.07, 95.78, 3);//Move the object
SendClientMessage(playerid, COLOR_RED, "The gate is closing! Be back soon sugahpuffs!");//Send the message
Opened = false; //Set variable "Opened" to false, so the server will know it's not opened
}
}
}
return 1;
}