Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////------------------------------------////
- ////Admigo's Gametime+Gameday System 1.3////
- ////------------------------------------////
- //Includes//
- #include <a_samp>
- #include <sscanf2>
- //--------//
- //Defines//
- #define COLOR_TIME 0xFFFFFFFF //Change the colour of the time textdraw here
- #define COLOR_DAY 0xFFFFFFFF //Change the colour of the day textdraw here
- #define MINUTE 1000
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define COLOR_RED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- //-------//
- //Forwards//
- forward Timer();
- //--------//
- //New Defines//
- new Text:gTime;
- new Text:gDay;
- new gtime=0;
- new gday=0;
- new N11=0;
- //-----------//
- //Publics//
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Admigo's Gametime+Gameday System 1.3");
- print("--------------------------------------\n");
- SetTimer("Timer",MINUTE,1);//
- gTime = TextDrawCreate(605.000000,25.000000,"00:00");
- TextDrawAlignment(gTime,3);
- TextDrawBackgroundColor(gTime,0x000000FF);
- TextDrawFont(gTime,3);
- TextDrawLetterSize(gTime,0.535,2.2);
- TextDrawColor(gTime,COLOR_TIME);
- TextDrawSetOutline(gTime,2);
- TextDrawSetProportional(gTime,1);
- TextDrawSetShadow(gTime,1);
- gDay = TextDrawCreate(610.000000,7.000000,"Sunday");
- TextDrawUseBox(gDay,0);
- TextDrawFont(gDay,3);
- TextDrawLetterSize(gDay,0.6,1.5);
- TextDrawSetShadow(gDay,1);
- TextDrawSetOutline(gDay ,0);
- TextDrawBackgroundColor(gDay, 0x000000FF);
- TextDrawBoxColor(gDay ,0x00000066);
- TextDrawColor(gDay,COLOR_DAY);
- TextDrawTextSize(gDay , -1880.0, -1880.0);
- TextDrawAlignment(gDay,3);
- TextDrawSetOutline(gDay,1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerCommandText(playerid,cmdtext[])
- {
- dcmd(settime,7,cmdtext);
- dcmd(setday,6,cmdtext);
- return 0;
- }
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"This server uses Admigo's Gametime+Gameday System 1.3");
- return 1;
- }
- public Timer()
- {
- new timestring[256];
- new daystring[256];
- new gseconds = gtime % 60,
- gminutes = (gtime - gseconds) / 60;
- gtime ++;
- format(timestring, sizeof (timestring), " %02d:%02d", gminutes, gseconds);
- TextDrawSetString(gTime,timestring);
- TextDrawShowForAll(gTime);
- format(daystring, sizeof (daystring), "%s",GetDayName());
- TextDrawSetString(gDay,daystring);
- TextDrawShowForAll(gDay);
- if(gday==6&>ime==1440)//One week passed
- {
- gday=0;
- gtime=0;
- //A new week has begun
- }
- if(gtime==1440)//One day passed
- {
- gday++;
- gtime=0;
- format(daystring, sizeof (daystring), " 00:00");
- TextDrawSetString(gTime,daystring);
- }
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SetPlayerTime( i, gminutes, gseconds);
- }
- }
- return 1;
- }
- //-------//
- //Dcmd Commands//
- dcmd_settime(playerid,params[])
- {
- new string[128];
- new N1,N2;
- new pname[24];
- GetPlayerName(playerid,pname,sizeof(pname));
- if(!IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid,COLOR_RED,"You need to be an admin to use this command!");
- return 1;
- }
- if(sscanf(params, "ii", N1,N2))
- {
- SendClientMessage(playerid,COLOR_RED,"USAGE: /settime (Hour) (Minute)");
- return 1;
- }
- if(N1 < 0 || N1 > 23)
- {
- SendClientMessage(playerid,COLOR_RED,"Please enter an amount between 0 and 23.");
- return 1;
- }
- if(N2 < 0 || N2 > 59)
- {
- SendClientMessage(playerid,COLOR_RED,"Please enter an amount between 0 and 59.");
- return 1;
- }
- N11= N1 * 60;
- gtime=N11 + N2;
- format(string,sizeof(string),"%s(%d) has changed the time to %02d:%02d!",pname,playerid,N1,N2);
- SendClientMessageToAll(COLOR_YELLOW,string);
- return 1;
- }
- dcmd_setday(playerid,params[])
- {
- new string[128];
- new N1;
- new pname[24];
- GetPlayerName(playerid,pname,sizeof(pname));
- if(!IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid,COLOR_RED,"You need to be an admin to use this command!");
- return 1;
- }
- if(sscanf(params, "i", N1))
- {
- SendClientMessage(playerid,COLOR_RED,"USAGE: /setday (Day)");
- return 1;
- }
- if(N1 < 0 || N1 > 6)
- {
- SendClientMessage(playerid,COLOR_RED,"Please enter an amount between 0 and 6.");
- return 1;
- }
- gday=N1;
- format(string,sizeof(string),"%s(%d) has changed the day to %s!",pname,playerid,GetDayName());
- SendClientMessageToAll(COLOR_YELLOW,string);
- return 1;
- }
- //-------------//
- //Stocks//
- stock GetDayName()
- {
- new DayName[128];
- switch(gday)
- {
- //All day names can be changed to your language.
- case 0: format(DayName, sizeof(DayName), "Sunday");
- case 1: format(DayName, sizeof(DayName), "Monday");
- case 2: format(DayName, sizeof(DayName), "Tuesday");
- case 3: format(DayName, sizeof(DayName), "Wednesday");
- case 4: format(DayName, sizeof(DayName), "Thursday");
- case 5: format(DayName, sizeof(DayName), "Friday");
- case 6: format(DayName, sizeof(DayName), "Saturday");
- }
- return DayName;
- }
- //------//
Advertisement
Add Comment
Please, Sign In to add comment