[FilterScript] Real Time for each player's Timezone
#1

Very simple... because i dunno how to do anything hard yet lol. This script will set each players game time to match their REAL time. All you have to do is change the servergmt value to the GMT of your server. I intentionally did it OnPlayerSpawn because in my TDM server players spawn constantly so I did not need to use a timer. If you want, you can put it on a timer yourself quite easily.

I tested, and am using this script on my server. No video since it would be pointless.

Requirements

-GeoIP plugin
-GeoIP include

Code:
// Player Time Zone by Klabauter_Mann
// Please do not remove the credits or claim this script as your own
// You must have GeoIP plugin to use this script
// You must have GeoIP include to compile this script

#include <a_samp>
#include GeoIP_Plugin

#define servergmt 0 // Set the GMT of your server, example: if your server is in New York City change 0 to -5

public OnFilterScriptInit()
{
    print("\n-------------------------------------------------");
    print(" Player Time Zone by Klabauter_Mann");
    print("-------------------------------------------------\n");
    return true;
}

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0xC071FFFF, "This server is using Player Time Zone");
    SendClientMessage(playerid, 0xC071FFFF, "Made by Klabauter_Mann");
    return true;
}

public OnPlayerSpawn(playerid)
{
    new Hour, Minute, Second;
    gettime(Hour, Minute, Second);
    new gmt = GetPlayerGMT(playerid);
    new sum = Hour + gmt - servergmt;
    if(sum >= 24 && sum < 48)
        {
        SetPlayerTime(playerid, sum - 24, Minute);
        }
    if(sum >= 48)
        {
        SetPlayerTime(playerid, sum - 48, Minute);
        }
    if(sum < 0)
        {
        SetPlayerTime(playerid, sum + 24, Minute);
        }
    if(sum >= 0 && sum < 24)
	{
	SetPlayerTime(playerid, sum, Minute);
	}
    return true;
}
Updates

- Fixed problem with sums that are less than zero or greater than 23
Reply
#2

nice
Reply
#3

really nice.
Reply
#4

Cool.
Reply
#5

this is very good, considering that this is your first script post +1
Reply
#6

Sweet and simple
Reply
#7

Easy and nice.
Reply
#8

I fixed the problem that occurs when the sum of "Hour + gmt - servergmt" is greater than 23 or less than zero. I guess that the simplicity of the original script was a bit of wishful thinking.
Reply
#9

Nice ill try it out
Reply
#10

Saved me a job cheers dude.
Reply
#11

Another Nice One, so simple
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)