18.04.2013, 14:50
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% ?
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.
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;
}
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% ?
|
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);
*/
}