24.11.2011, 15:30
pawn Код:
new Gate,
bool:IsOpened,
password[24] = "hellsangels";
public OnGameModeInit()
{
Gate = CreateObject(969,1504.50000000,-699.70001221,93.80000305,0.00000000,0.00000000,180.00000000); //object(electricgate) (1)
IsOpened = false; //set it's status to closed
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp("/gate",cmdtext,true))
{
if(!IsPlayerInRangeOfPoint(playerid,10.0,1504.50000000,-699.70001221,93.80000305)) return SendClientMessage(playerid,-1, "You aren't near any gate!");//replace with your gate x,y,z
if(strlen(cmdtext) < 7) return SendClientMessage(playerid,-1,"Usage: /gate [password]");
strdel(cmdtext, 0, strfind(cmdtext, " "));
if(strcmp(cmdtext,password,true) != 0) return SendClientMessage(playerid,-1,"Wrong Password!");
switch(IsOpened)
{
case true:
{
IsOpened = false;
SendClientMessage(playerid,-1,"Gate is closing!");
MoveObject(Gate,1504.50000000,-699.70001221,93.80000305,5.0); //co-ordinates of closed gate
}
case false:
{
IsOpened = true;
SendClientMessage(playerid,-1,"Gate is opening!");
MoveObject(Gate,1512.00000000,-699.69897461,93.80000305,5.0); //co-ordinates of opened gate
}
}
return 1;
}
return 0;
}