Player Clock - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player Clock (
/showthread.php?tid=69990)
Player Clock -
StrickenKid - 22.03.2009
Im making a Cops And Robbers and i want to have a clock with the time and day, im using the toggleplayerclock and i got this function from lvrcr
pawn Код:
public TimeWorld()
{
if(gametime == 23 && gameday == 7)
gametime++;
if(gametime >= 24) {
gametime =0;
}
if(gametime == 0 && gameday <= 7) {
gameday ++;
}
for(new i=0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetPlayerTime(i,gametime,0);
}
}
new string[30];
SetWorldTime(gametime);
format(string, sizeof(string), "Game Time: %d:00", gametime);
SendClientMessageToAll(0x5F9EA0AA, string);
if(gametime == 0 && gameday == 1) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Monday");
}
if(gametime == 0 && gameday == 2) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Tuesday");
}
if(gametime == 0 && gameday == 3) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Wednesday");
}
if(gametime == 0 && gameday == 4) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Thursday");
}
if(gametime == 0 && gameday == 5) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Friday");
}
if(gametime == 0 && gameday == 6) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Saturday");
}
if(gametime == 0 && gameday == 7) {
SendClientMessageToAll(0x5F9EA0AA,"Game Day: Sunday");
}
if(gametime == 23 && gameday == 7) {
SendClientMessageToAll(0x2587CEAA,"*Game Day: This week is over.");
SendClientMessageToAll(0x2587CEAA,"*AutoAdmin: Don't forget to visit our website at ");
}
}
but every time the time hits 13:00 it resets to 12:00 why is this happening, and how can i fix it?
also the timer is:
pawn Код:
SetTimer("TimeWorld",60000,1);
Thanks in advance!
Re: Player Clock -
StrickenKid - 22.03.2009
BUMP:
anyone? please!
Re: Player Clock -
Nero_3D - 22.03.2009
also if it hits 13:00 than it gets immediately reseted to 12:00 ?
Than how you know it even was on 13:00 ?
and for what you use the first if statment "if(gametime == 23 && gameday == 7)" ?
Try that
pawn Код:
public TimeWorld()
{
new string[30];
SetWorldTime(++gametime);
format(string, sizeof(string), "Game Time: %02d:00", gametime);
SendClientMessageToAll(0x5F9EA0AA, string);
switch(gametime)
{
case 6: SendClientMessageToAll(0x5F9EA0AA, "Good Morning");
case 12: SendClientMessageToAll(0x5F9EA0AA, "Good Midday");
case 14: SendClientMessageToAll(0x5F9EA0AA, "Good Afternoon");
case 18: SendClientMessageToAll(0x5F9EA0AA, "Good Evening");
case 22: SendClientMessageToAll(0x5F9EA0AA, "Good Night");
case 23:
if(gameday == 7)
{
SendClientMessageToAll(0x2587CEAA,"*Game Day: This week is so good like over.");
SendClientMessageToAll(0x2587CEAA,"*AutoAdmin: Don't forget to visit our website at ");
}
case 24:
{
gametime = 0;
if(++gameday > 7) gameday = 1;
switch(gameday)
{
case 1: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Monday");
case 2: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Tuesday");
case 3: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Wednesday");
case 4: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Thursday");
case 5: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Friday");
case 6: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Saturday");
case 7: SendClientMessageToAll(0x5F9EA0AA,"Game Day: Sunday");
}
}
}
for(new i; i < MAX_PLAYERS; i++)
SetPlayerTime(i, gametime, 0);
}
Re: Player Clock -
StrickenKid - 22.03.2009
lol like i said i got it directly from lvrcr so its not my script, its who ever scripted lvrcr but thx allot! ill try that!
EDIT: is this a good synchronized way?