Textdraw problem
#1

How to make Textdraw showing When Certain Gate is opened or closed

When the gate is opened the Textdraw says Trader: OPENED
and when Gate is closed the textdraw says Trader: CLOSED

[ I know how to make a textdraw but i dont know how to make textdraw show when OPENED and when CLOSED ]
Reply
#2

Just create a variable
pawn Код:
if(MyVariable == 1)
{
MyTextdraw = TextDrawCreate(155.000000, 119.000000, "Gate Status: Opened");
}
if(MyVariable == 0)
{
MyTextdraw = TextDrawCreate(155.000000, 119.000000, "Gate Status: Closed");
}
Reply
#3

Where i have to put it under, I dont understand
Reply
#4

pawn Код:
MyTextdraw = TextDrawCreate(155.000000, 119.000000, "Gate Status: Opened");
At the moment of opening the gate.

pawn Код:
MyTextdraw = TextDrawCreate(155.000000, 119.000000, "Gate Status: Closed");
At the moment of closing the gate.

EG:

pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/open", true) == 0)
  {
    // the code to open the gate
    MyTextdraw = TextDrawCreate(155.000000, 119.000000, "Gate Status: Opened");
    return 1;
  }
  else if(strcmp(cmdtext, "/close", true) == 0)
  {
    // code to close the gate
    MyTextdraw = TextDrawCreate(155.000000, 119.000000, "Gate Status: Closed");
    return 1;
  }
  return 0;
}
Reply
#5

Gate opens automatically in 3 minutes and closes in 1 minute

GATE IS NOT CONTROLLED BY COMMAND
Reply
#6

Show us your gate code.
Reply
#7

forward Traders();


Under OnGameModeInit:
Код:
SetTimer("Traders",180000,true);
Код:
public Traders()
{
  print("Traders doors are now open");
  MoveObject(Trader1,0.0,0.0,0.0,1.5000);
  SetTimer("close",100000,false);

  //Opens every 3min Closes every 10 Sec
}

forward close();
public close()
{
  print("Traders doors are now closed");
  MoveObject(Trader1,1644.0217285156, -1714.6821289063, 15.864986419678,1.5000);
}



Reply
#8

Try this (Not Tested):

In Top:
pawn Код:
new Text: GateStats[MAX_PLAYERS];
InOnGameModeInit:
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
GateStats[i] = TextDrawCreate(155.000000, 119.000000, " ");
}
//Your complete TextDraw code...
In "Traders":
pawn Код:
public Traders()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
TextDrawShowForPlayer(playerid, GateStats[i]);
TextDrawSetString(GateStats[i], "Gate Status: Opened!");
}
print("Traders doors are now open");
MoveObject(Trader1,0.0,0.0,0.0,1.5000);
SetTimer("close",100000,false);
}
In "close":
pawn Код:
public close()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
TextDrawSetString(GateStats[i], "Gate Status: Closing!");
}
print("Traders doors are now closed");
SetTimer("HideTD",5000,false);
MoveObject(Trader1,1644.0217285156, -1714.6821289063, 15.864986419678,1.5000);
}
And "HideTD":
pawn Код:
public HideTD()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
TextDrawHideForPlayer(playerid, GateStats[i]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)