Game time -
MichaelWharton101 - 08.04.2013
Okay, so i have a command called /tod it set's the time of day... But need to make a IG clock that will be like 'Game Time: %d:%d:%d' and when i would GMX it will set it to something like '0Hour:0Min:0Sec' and begin to count up. and on the command /tod it will change it to the hour i set it to. so lets say '/tod 5' it will change to '5:0:0' then when it hits '24:60:60' it will start over at '0:0:0' and start to count up once more. If you need my /tod command i will give it to you, I have tried the past few days and just give up now.
Re: Game time -
Pawnie - 08.04.2013
Something like this?
Код:
if(strcmp(cmd, "/tod", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "Usage: /tod [timeofday] (0-23)");
if(PlayerInfo[playerid][pAdmin] >= 1337) return SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command!");
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected) SetPlayerTime(i, strval(tmp), 0);
format(string, sizeof(string), " Time set to %d:00.", strval(tmp));
return BroadCast(COLOR_GRAD1, string);
}
Or you need the automatic time change?
Re: Game time -
MichaelWharton101 - 08.04.2013
Well i need it to be automatic, I am going to make it working with a textdraw... I will show you a pic of what I want it to be like.
IMG:
besides it would start at time 0:0:0 on GMX and then I got a command that is '/tod' and when used it would also change the time of the textdraw so '/tod 4' it would then be 4hour:0minute:0secound.
CMD to /tod
Код:
CMD:tod(playerid, params[])
{
new string[128], input;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
if(sscanf(params, "i", input)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /tod [hour]");
if(input > 23) return SendClientMessage(playerid, COLOR_GREY, "Hours are between 0 and 23.");
gettime(thour, tmin, tsec);
thour = input;
SetWorldTime(input);
format(string, sizeof(string), "AdmWarn: %s has set the time to %d.", RPN(playerid), input);
SendAdminMessage(COLOR_DARKRED, 1, string);
return 1;
}
btw thanks for fast response
Re: Game time -
MichaelWharton101 - 09.04.2013
May had got it, Will update you if I have
Re: Game time -
Pawnie - 09.04.2013
Hmm I got ya idea. Here you go
Код:
public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
TextDrawSetString(Time, string);
}
Код:
new Text:Time, Text:Date;
forward settime(playerid);
Код:
//game mode init
SetTimer("settime",1000,true);
Also make sure you just add it to the textdraw
Код:
new Text:Time, Text:Date;
Код:
//GameModeInit
Date = TextDrawCreate(547.000000,11.000000,"--");
TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.399999,1.600000);
TextDrawColor(Date,0xffffffff);
Time = TextDrawCreate(547.000000,28.000000,"--");
TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.399999,1.600000);
TextDrawColor(Time,0xffffffff);
Re: Game time -
MichaelWharton101 - 10.04.2013
Thank you