Moving Gate Help
#1

Hi My script is setup like this:

#include <Object>
#include <IsPlayerLAdmin>

new evevator;
new isopened4;

public OnFilterScriptInit()
{
elevator = CreateStreamedObject(3095, -294.865967, 1866.683960, 41.285698, 0.0000, 0.0000, 34.3775);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(up, 2, cmdtext);
dcmd(down, 4, cmdtext);
return 1;
}

dcmd_up(playerid,params[])
{
#pragma unused params
if(isopened4 == 0)
{
MoveObject(elevator, -294.865967, 1866.683960, 150.285698, 5.00 );
SendClientMessage(playerid, 0xFF0000AA, "Elevator Rising");
isopened4 = 1;
}
else SendClientMessage(playerid, 0xFF0000AA, "Elevator Already Up!");

return 1;
}
dcmd_down(playerid,params[])
{
#pragma unused params
if(isopened4 == 1)
{
MoveObject(elevator, -294.865967, 1866.683960, 41.285698, 10.00 );
SendClientMessage(playerid, 0xFF0000AA, "Elevator Lowering");
isopened4 = 0;
}
else SendClientMessage(playerid, 0xFF0000AA, "Elevator Already Down!");

return 1;
}

How can I make it so it says ERROR: Elevator is already moving please wait. because people like to kill people by doing /up down up.
Reply
#2

pawn Code:
if(elegatormoving) return SendClientMessage(playerid,color,"The elegator is moving, you have to wait.");
Reply
#3

well make it so.

pawn Code:
#include <Object>
#include <IsPlayerLAdmin>

new evevator;
new isopened4;
new Moving;

forward IsMoving();

public IsMoving()
{
Moving = 0;
}

public OnFilterScriptInit()
{
  elevator = CreateStreamedObject(3095, -294.865967, 1866.683960, 41.285698, 0.0000, 0.0000, 34.3775);
  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(up, 2, cmdtext);
  dcmd(down, 4, cmdtext);
    return 1;
}

dcmd_up(playerid,params[])
{
  #pragma unused params
  if(isopened4 == 0)
  {
  if(Moving == 1)
  {
  SendClientMessage(playerid, COLOR_GREY, "Wait For Lift To Come Back Down.");
  return 1;}

  MoveObject(elevator, -294.865967, 1866.683960, 150.285698, 5.00 );
  SendClientMessage(playerid, 0xFF0000AA, "Elevator Rising");
  isopened4 = 1;
  Moving[playerid] = 1;
  SetTimer("IsMoving", 10000, 0);// its 10 seconds before command ok to use again
  }
  else SendClientMessage(playerid, 0xFF0000AA, "Elevator Already Up!");

  return 1;
}
dcmd_down(playerid,params[])
{
  #pragma unused params
  if(isopened4 == 1)
  {
  if(Moving == 1)
  {
  SendClientMessage(playerid, COLOR_GREY, "Wait For Lift To Come Back up.");
  return 1;}
    MoveObject(elevator, -294.865967, 1866.683960, 41.285698, 10.00 );
    SendClientMessage(playerid, 0xFF0000AA, "Elevator Lowering");
    isopened4 = 0;
    Moving[playerid] = 1;
  SetTimer("IsMoving", 10000, 0);// its 10 seconds before its ok to use command again
  }
  else SendClientMessage(playerid, 0xFF0000AA, "Elevator Already Down!");

  return 1;
}
Just edit the timer to the ammount of time it takes this should work if not let me no as i just quickly made this
Reply
#4

Quote:
Originally Posted by MenaceX^
pawn Code:
if(elegatormoving) return SendClientMessage(playerid,color,"The elegator is moving, you have to wait.");
Dosnt this say elegator aint it ment to say evevator?? lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)