Toilet Help [REP ++]
#1

Hi All.I maked my Toilet system.I using a textdraw but now i want to make when player type /toilet to textdraw go 1, 2,3,4,5,6,7...100% how to make it ? To textdraw set a string from 0% to 100% ?
Reply
#2

Using a timer, and updating the text draw ID .
Reply
#3

if you want to make me it ?
Reply
#4

You can use timers and update the text string using 'TextDrawSetString' or if it's Player TextDraw, 'PlayerTextDrawSetString'.

Example:
pawn Код:
new PlayerText:TDToilet[MAX_PLAYERS]; //Player Textdraw.
new Ttimer[MAX_PLAYERS]; //Timer variable as it's focused on a player. (Not GLOBAL)
new TDCount[MAX_PLAYERS]; //Counts to show it upon the textdraw.
new Toilet[MAX_PLAYERS]; //A variable to show the player is in toilet.
CMD:toilet(playerid, params[])
{
 Ttimer[playerid] = SetTimerEx("TDToiletUpd", 1000, true, "d", playerid); //Sets the timer, as it's set true; it repeats.
 Toilet[playerid] = 1; //Player is set to toilet mode.
 return 1;
}

forward  TDToiletUpd(playerid);

public TDToiletUpd(playerid)
{
 if(!IsPlayerConnect(playerid) || Toilet[playerid] != 1) return KillTimer(TDToiletUpd(playerid)); //If the player isn't connected or not in toilet, then the timer stops or KILLS.
 TDCount[playerid]++; //As the timer goes on, it rises the count.
 TextDrawSetString(playerid, TDToilet[playerid], TDCount[playerid]);
 return 1;
}

//This is just an example.
Reply
#5

But textdraw ?
Reply
#6

@Lordz: your code won't even compile. You can't set the STRING of the textdraw (TextDrawSetString) to an INTEGER.
Reply
#7

TextDrawSetString(textdrawid,string); , 2 paramter but in your script you got 3 parameter
Anyway everyone can make mistake
he will get warning
warning 202: Number of arguments does not match definition.
pawn Код:
public TDToiletUpd(playerid)
{
 if(!IsPlayerConnect(playerid) || Toilet[playerid] != 1) return KillTimer(TDToiletUpd(playerid)); //If the player isn't connected or not in toilet, then the timer stops or KILLS.
 TDCount[playerid]++; //As the timer goes on, it rises the count.
  new string[256];
  format(string,sizeof(string),"%d;%d"TDToilet[playerid],TDCount[playerid]);
 TextDrawSetString(playerid, string);
 return 1;
}
Reply
#8

BUMP !
Reply
#9

Quote:
Originally Posted by ScripteRMKD
Посмотреть сообщение
Hi All.I maked my Toilet system.I using a textdraw but now i want to make when player type /toilet to textdraw go 1, 2,3,4,5,6,7...100% how to make it ? To textdraw set a string from 0% to 100% ?
example [TESTED]
pawn Код:
new RMKD[MAX_PLAYERS];
new Timer[MAX_PLAYERS];
CMD:toilet(playerid,params[])
{
   RMKD[playerid] = 100; //
   Timer[playerid] = SetTimerEx("UpdateX",100,1,"d",playerid),
   TextDrawShowForPlayer(playerid,Text:text);
}
forward UpdateX(playerid);
public UpdateX(playerid)
{
  new string[128];
  if(RMDK[playerid] == 0)
  {
      // remove the textdraws here
     KillTimer(Timer[playerid]);
  return 0;
  }
  RMDK[playerid] --;
  format(string,sizeof(string)," %d",RMDK[playerid]);
  TextDrawSetString(text:tdname,string); // set the textdraw name
  /*
  if is playertextdraw use
  PlayerTextDrawSetString(Text:text,string);
  */

}
Reply
#10

TRhanks bro for this but i want from 0 to 100
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)