[Help] Me making server /time
#1

I have just started to decide to make a time system for my script, but because i got no clue where i would start (well i got ideas, but nothing i think is the easiest way to do it) i looked into a GF edit script at the time. i noticed a function called 'getdate' and 'gettime' and they are in the 'time.inc' include file, and its quite short so ill just post the include here:

Код:
/* Date/time functions
 *
 * © Copyright 2001-2005, ITB CompuPhase
 * This file is provided as is (no warranties).
 */
#if defined _time_included
 #endinput
#endif
#define _time_included
#pragma library Time

native gettime(&hour=0, &minute=0, &second=0);
native getdate(&year=0, &month=0, &day=0);
native tickcount(&granularity=0);
Now i know how i can use it, because i am not a compelte idiot, but does this get the time of the PLAYERS pc/country or does it get the time of the SERVERS time/country time....or does it do somthing else completely

thanks for any help people give
Reply
#2

Server's time/date.

Everything is on wiki, too:
https://sampwiki.blast.hk/wiki/Gettime
https://sampwiki.blast.hk/wiki/Getdate
Reply
#3

Quote:
Originally Posted by Don Correlli
ye but how do i Set the server time?
Reply
#4

Quote:
Originally Posted by Mowgli
ye but how do i Set the server time?
You can't.
Reply
#5

So, where does the Date come from?
Reply
#6

https://sampwiki.blast.hk/wiki/SetWorldTime

You can only set the World time.
Reply
#7

will GetDate and GetTime get the time of were the server is?
Reply
#8

Quote:
Originally Posted by Mowgli
will GetDate and GetTime get the time of were the server is?
I already answered your question, yes.
Reply
#9

hi guys right one question

how do i use this function to make my payday pay player every hour i have tried and failed lots of times (not that it a bad thing as i learnt how to do a few other things while trying to sort this)

this is my payday code not to hard it works fine on a timer but that means it pays an hour after the server was started and i need it to pay even if i have just started the server

Код:
public PayDay()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		  if(AccountInfo[i][aLogged] == 1)
		  {
			if (GetPlayerTotalMoney(i) >= PayCutoff)
			{
				SendClientMessage(i,COLOR_WHITE,"[Info:] You are to rich dont expect a Giro this time");
				}
	 		new wstring[256];
	 		new intrate = 1*AccountInfo[i][aScore];
//			new randcheck = 999 + random(4999);
			new interest = (AccountInfo[i][aBank]/1000)*(intrate);
//			new Level = AccountInfo[i][aScore];
			new payday = BasePay*AccountInfo[i][aScore];
			new newbank = AccountInfo[i][aBank] + interest;
			new randtax = 20 + random(50);
			new Gtax = payday/randtax;
			SendClientMessage(i,COLOR_GREEN,"|_____________Bank_of_San_Andreas______________|");
			SendClientMessage(i,COLOR_GREEN,"|___________________PaySlip____________________|");
			format(wstring, sizeof(wstring), "~y~PayDay~n~~w~Paycheck: ~g~%d",payday);
			GameTextForPlayer(i, wstring, 5000, 1);
		  format(wstring, sizeof(wstring), "PayCheck: $%d", payday);
		  SendClientMessage(i,COLOR_WHITE, wstring);
		  format(wstring, sizeof(wstring), "Balance: $%d, Interest Gained: $%d, New Balance: $%d, Interest Rate: 0.%d percent", AccountInfo[i][aBank], interest, newbank, intrate);
		  SendClientMessage(i,COLOR_WHITE, wstring);
		  format(wstring, sizeof(wstring), "Government Taxes: $%d", Gtax);
		  SendClientMessage(i,COLOR_WHITE, wstring);
		  AccountInfo[i][aBank] += interest;
		  AccountInfo[i][aBank] -= Gtax;
		  AccountInfo[i][aBank] += payday;
			AccountInfo[i][aXP]++;
			if(AccountInfo[i][aReport] > 0)
			AccountInfo[i][aReport]--;
			if(AccountInfo[i][aTacklebox] > 0)
			AccountInfo[i][aTacklebox]--;
			SendClientMessage(i,COLOR_GREEN,"______________________________________________________________________________________");
			}
				else
				{
					SendClientMessage(i,COLOR_WHITE,"[Info:] Payday not received, not played long enough");
				}
			}
			else
			{
				SendClientMessage(i,COLOR_WHITE,"[Info:] You are not logged in, payday not received");
			}
		}
	}
i will post more if you need it but i cant see anything else that might be needed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)