23.03.2009, 15:51
Hey, how would i do this, i'm using Ladmin, and have modified some parts, the GT works, but wen it gets to 60 mins, it goes back to 0, as i only want it to tell mins not hours, seconds. how would i do this? it just goes to 60 and then back to 0, id'e like it to go from 60 then to 61, 62,63 so on.. Heres my code please help me
The Function:
The textdraw & the formats to add the 0's ect..
Under "OnPlayerConnect(playerid)"
Forwards / new's
and incase that isn't enough info to fix it or tell me how to fix it iv'e uploaded it to pastebin ( the whole code )
http://joes.pastebin.com/m793e7c6f
Well thanks in advanced if your'e able to help me.
The Function:
pawn Код:
TotalGameTime(playerid, &m=0)
{
PlayerInfo[playerid][TotalTime] = ( (gettime() - PlayerInfo[playerid][ConnectTime]) /*(PlayerInfo[playerid][hours]*60*60)*/ + (PlayerInfo[playerid][mins]*60) );//(PlayerInfo[playerid][secs]) );
//h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
m = floatround(PlayerInfo[playerid][TotalTime] / 60, floatround_floor) % 60 ;
//s = floatround(PlayerInfo[playerid][TotalTime] % 60, floatround_floor);
return PlayerInfo[playerid][TotalTime];
}
pawn Код:
public gamet(playerid)
{
if(PlayerInfo[playerid][LoggedIn] == 1)
{
new m;
TotalGameTime(playerid,m);
if(m >= 0 && m <= 0)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"00000000");
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
if(m >= 0 && m <= 9)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"0000000%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 10 && m <= 99)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"000000%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 100 && m <= 999)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"00000%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 1000 && m <= 9999)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"0000%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 10000 && m <= 99999)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"000%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 100000 && m <= 999999)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"00%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 1000000 && m <= 9999999)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"0%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
TotalGameTime(playerid,m);
if(m >= 10000000 && m <= 99999999)
{
new gtstring[128];
format(gtstring,sizeof(gtstring),"%d",m);
TextDrawSetString(Text:Textdraw2[playerid],gtstring);
return 1;
}
else
{
TextDrawHideForPlayer(playerid,Textdraw2[playerid]);
TextDrawHideForPlayer(playerid,Textdraw0);
TextDrawHideForPlayer(playerid,Textdraw1);
return 1;
}
}
return 1;
}
pawn Код:
Textdraw2[playerid] = TextDrawCreate(513.000000,0.000000,"00000000");
TextDrawAlignment(Textdraw2[playerid],0);
TextDrawBackgroundColor(Textdraw2[playerid],0x000000ff);
TextDrawFont(Textdraw1,2);
TextDrawFont(Textdraw2[playerid],2);
TextDrawLetterSize(Textdraw2[playerid],0.499999,2.099999);
TextDrawColor(Textdraw2[playerid],0xffffffff);
TextDrawSetOutline(Textdraw2[playerid],1);
TextDrawSetProportional(Textdraw2[playerid],1);
TextDrawSetShadow(Textdraw2[playerid],1);
SetTimerEx("gamet", 100, 1, "i", playerid);
pawn Код:
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2[MAX_PLAYERS];
new Text:Textdraw3;
forward gamet(playerid);
http://joes.pastebin.com/m793e7c6f
Well thanks in advanced if your'e able to help me.