Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**********************************************
- CRÉDITOS:
- include a_samp by #SA:MP TEAM
- include zcmd by #ZeeX
- include sscanf2 by #Y_Less
- TextDraw editor by #iPLEOMAX
- Script by F1N4L
- **********************************************/
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXTDRAW_DATA_HORA_PLAYERS=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- new Text:HORA[2];
- new PlayerText:DESP[2][MAX_PLAYERS];
- new
- P_TIME[3],
- D_TIME[3]
- ;
- new DESPERTADOR[MAX_PLAYERS];
- new RELOGIO[MAX_PLAYERS];
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXTDRAW_DATA_HORA_PLAYERS=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXTDRAW_DATE_TIME_PLAYERS=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- stock DateTimePlayers_TextDraw(playerid)
- {
- HORA[0] = TextDrawCreate(485.675201, 0.083303, "|HORA|");
- TextDrawLetterSize(HORA[0], 0.350000, 1.001667);
- TextDrawAlignment(HORA[0], 1);
- TextDrawColor(HORA[0], -16776961);
- TextDrawSetOutline(HORA[0], 0);
- TextDrawBackgroundColor(HORA[0], 255);
- TextDrawFont(HORA[0], 2);
- TextDrawSetProportional(HORA[0], 1);
- TextDrawSetShadow(HORA[0], 0);
- HORA[1] = TextDrawCreate(481.228942, 7.149960, "00:00:00");
- TextDrawLetterSize(HORA[1], 0.350000, 1.521666);
- TextDrawAlignment(HORA[1], 1);
- TextDrawColor(HORA[1], -16776961);
- TextDrawSetOutline(HORA[1], 0);
- TextDrawBackgroundColor(HORA[1], 255);
- TextDrawFont(HORA[1], 2);
- TextDrawSetProportional(HORA[1], 1);
- TextDrawSetShadow(HORA[1], 0);
- DESP[playerid][2] = CreatePlayerTextDraw(playerid, 183.176528, 138.083312, "DESPERTADOR");
- PlayerTextDrawLetterSize(playerid, DESP[playerid][2], 0.960940, 6.727499);
- PlayerTextDrawAlignment(playerid, DESP[playerid][2], 1);
- PlayerTextDrawColor(playerid, DESP[playerid][2], 65535);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][2], 0);
- PlayerTextDrawSetOutline(playerid, DESP[playerid][2], 0);
- PlayerTextDrawBackgroundColor(playerid, DESP[playerid][2], 255);
- PlayerTextDrawFont(playerid, DESP[playerid][2], 2);
- PlayerTextDrawSetProportional(playerid, DESP[playerid][2], 1);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][2], 0);
- DESP[playerid][1] = CreatePlayerTextDraw(playerid, 249.058807, 185.333358, "HORA");
- PlayerTextDrawLetterSize(playerid, DESP[playerid][1], 1.256940, 5.648333);
- PlayerTextDrawAlignment(playerid, DESP[playerid][1], 1);
- PlayerTextDrawColor(playerid, DESP[playerid][1], 65535);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][1], 0);
- PlayerTextDrawSetOutline(playerid, DESP[playerid][1], 0);
- PlayerTextDrawBackgroundColor(playerid, DESP[playerid][1], 255);
- PlayerTextDrawFont(playerid, DESP[playerid][1], 2);
- PlayerTextDrawSetProportional(playerid, DESP[playerid][1], 1);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][1], 0);
- DESP[playerid][0] = CreatePlayerTextDraw(playerid, 322.941101, 149.750030, "_");
- PlayerTextDrawLetterSize(playerid, DESP[playerid][0], 0.415529, 9.585833);
- PlayerTextDrawTextSize(playerid, DESP[playerid][0], 0.000000, 316.000000);
- PlayerTextDrawAlignment(playerid, DESP[playerid][0], 2);
- PlayerTextDrawColor(playerid, DESP[playerid][0], -1);
- PlayerTextDrawUseBox(playerid, DESP[playerid][0], 1);
- PlayerTextDrawBoxColor(playerid, DESP[playerid][0], 65298);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][0], 0);
- PlayerTextDrawSetOutline(playerid, DESP[playerid][0], 0);
- PlayerTextDrawBackgroundColor(playerid, DESP[playerid][0], 255);
- PlayerTextDrawFont(playerid, DESP[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid, DESP[playerid][0], 1);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][0], 0);
- return 1;
- }
- stock PlayeridText(playerid)
- {
- DESP[playerid][2] = CreatePlayerTextDraw(playerid, 183.176528, 138.083312, "DESPERTADOR");
- PlayerTextDrawLetterSize(playerid, DESP[playerid][2], 0.960940, 6.727499);
- PlayerTextDrawAlignment(playerid, DESP[playerid][2], 1);
- PlayerTextDrawColor(playerid, DESP[playerid][2], 65535);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][2], 0);
- PlayerTextDrawSetOutline(playerid, DESP[playerid][2], 0);
- PlayerTextDrawBackgroundColor(playerid, DESP[playerid][2], 255);
- PlayerTextDrawFont(playerid, DESP[playerid][2], 2);
- PlayerTextDrawSetProportional(playerid, DESP[playerid][2], 1);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][2], 0);
- DESP[playerid][1] = CreatePlayerTextDraw(playerid, 249.058807, 185.333358, " ");
- PlayerTextDrawLetterSize(playerid, DESP[playerid][1], 1.256940, 5.648333);
- PlayerTextDrawAlignment(playerid, DESP[playerid][1], 1);
- PlayerTextDrawColor(playerid, DESP[playerid][1], 65535);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][1], 0);
- PlayerTextDrawSetOutline(playerid, DESP[playerid][1], 0);
- PlayerTextDrawBackgroundColor(playerid, DESP[playerid][1], 255);
- PlayerTextDrawFont(playerid, DESP[playerid][1], 2);
- PlayerTextDrawSetProportional(playerid, DESP[playerid][1], 1);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][1], 0);
- DESP[playerid][0] = CreatePlayerTextDraw(playerid, 322.941101, 149.750030, "_");
- PlayerTextDrawLetterSize(playerid, DESP[playerid][0], 0.415529, 9.585833);
- PlayerTextDrawTextSize(playerid, DESP[playerid][0], 0.000000, 316.000000);
- PlayerTextDrawAlignment(playerid, DESP[playerid][0], 2);
- PlayerTextDrawColor(playerid, DESP[playerid][0], -1);
- PlayerTextDrawUseBox(playerid, DESP[playerid][0], 1);
- PlayerTextDrawBoxColor(playerid, DESP[playerid][0], 65298);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][0], 0);
- PlayerTextDrawSetOutline(playerid, DESP[playerid][0], 0);
- PlayerTextDrawBackgroundColor(playerid, DESP[playerid][0], 255);
- PlayerTextDrawFont(playerid, DESP[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid, DESP[playerid][0], 1);
- PlayerTextDrawSetShadow(playerid, DESP[playerid][0], 0);
- return 1;
- }
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXTDRAW_DATE_TIME_PLAYERS=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid,"Despertador",-1);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXT_DRAW_SHOW_SERVER=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- DateTimePlayers_TextDraw(playerid);
- TextDrawShowForPlayer(playerid, HORA[0]);
- TextDrawShowForPlayer(playerid, HORA[1]);
- RELOGIO[playerid] = SetTimerEx("TimePlayers_TextDraw", 1000, true, "i", playerid);
- SendClientMessage(playerid, -1, "Sistema de Despertador By F1N4L");
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXT_DRAW_SHOW_SERVER=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXT_DRAW_HIDE_SERVER=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- TextDrawHideForPlayer(playerid, HORA[0]);
- TextDrawHideForPlayer(playerid, HORA[1]);
- PlayerTextDrawHide(playerid, DESP[playerid][0]);
- PlayerTextDrawHide(playerid, DESP[playerid][1]);
- PlayerTextDrawHide(playerid, DESP[playerid][2]);
- KillTimer(DESPERTADOR[playerid]);
- KillTimer(RELOGIO[playerid]);
- //=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=TEXT_DRAW_HIDE_SERVER=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=
- return 1;
- }
- forward TimePlayers_TextDraw(playerid);
- public TimePlayers_TextDraw(playerid)
- {
- new string[10];
- gettime(P_TIME[0], P_TIME[1], P_TIME[2]);
- format(string, 128, "%02d:%02d:%02d", P_TIME[0], P_TIME[1], P_TIME[2]);
- TextDrawSetString(HORA[1], string);
- return 1;
- }
- CMD:desp(playerid, params[])
- {
- new string[90];
- if(GetPVarInt(playerid,"Despertador") == 0)
- {
- if(sscanf(params, "iii", D_TIME[0], D_TIME[1], D_TIME[2])) return SendClientMessage(playerid, -1, "USO: /desp [Hora] [Min] [Seg]");
- if(D_TIME[0] < 0 || D_TIME[0] > 23) return SendClientMessage(playerid, -1, "ERRO: A Hora deve ser entre 0 e 23.");
- if(D_TIME[0] < P_TIME[0]) return SendClientMessage(playerid, -1, "ERRO: A Hora deve ser maior que as Horas atuais.");
- if(D_TIME[1] < 0 || D_TIME[1] > 59) return SendClientMessage(playerid, -1, "ERRO: Os Minutos devem ser entre 0 e 59.");
- if(D_TIME[1] < P_TIME[1]) return SendClientMessage(playerid, -1, "ERRO: O Minuto deve ser maior que os Minutos atuais");
- if(D_TIME[2] < 0 || D_TIME[2] > 59) return SendClientMessage(playerid, -1, "ERRO: Os Segundos devem ser entre 0 e 59.");
- if(D_TIME[2] <= P_TIME[2]+5) return SendClientMessage(playerid, -1, "ERRO: O Segundo deve ser maior que os Segundos atuais.");
- format(string, sizeof(string), "Atualmente são: %02d:%02d:%02d", P_TIME[0], P_TIME[1], P_TIME[2]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "Horário Programado para Despertar: %02d:%02d", D_TIME[0], D_TIME[1]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "Ainda restam: %02d horas %02d minutos %02d segundos", D_TIME[0]-P_TIME[0], D_TIME[1]-P_TIME[1], D_TIME[2]-P_TIME[2]);
- SendClientMessage(playerid, -1, string);
- DESPERTADOR[playerid] = SetTimerEx("DESPERTADOR_Update", 1000, true, "i", playerid);
- SetPVarInt(playerid,"Despertador",1);
- }else{
- if(GetPVarInt(playerid,"Despertador") == -1)
- {
- SendClientMessage(playerid, -1, "Você ainda não iniciou o despertador, Digite: /desp [hora] [min] [seg]");
- SetPVarInt(playerid,"Despertador",0);
- }
- else if(GetPVarInt(playerid,"Despertador") == 1)
- {
- format(string, sizeof(string), "Você já Ativou o Despertador às: %02d:%02d:%02d", D_TIME[0], D_TIME[1], D_TIME[2]);
- SendClientMessage(playerid, -1, string);
- SendClientMessage(playerid, -1, "Para iniciar um novo despertador, Digite: /offdesp");
- }
- }
- if(GetPVarInt(playerid,"Despertador") == -1)
- {
- SendClientMessage(playerid, -1, "Você ainda não iniciou o despertador, Digite: /desp [hora] [min] [seg]");
- SetPVarInt(playerid,"Despertador",-1);
- }
- return 1;
- }
- CMD:offdesp(playerid, params[])
- {
- new string[80];
- if(GetPVarInt(playerid,"Despertador") == 0)
- {
- SendClientMessage(playerid, -1, "Você já desativou o Despertador!");
- }
- else if(GetPVarInt(playerid,"Despertador") == 1)
- {
- format(string, sizeof(string), "Relógio parado às: %02d:%02d:%02d", P_TIME[0], P_TIME[1], P_TIME[2]);
- SendClientMessage(playerid, -1, string);
- PlayerTextDrawHide(playerid, DESP[playerid][0]);
- PlayerTextDrawHide(playerid, DESP[playerid][1]);
- PlayerTextDrawHide(playerid, DESP[playerid][2]);
- KillTimer(DESPERTADOR[playerid]);
- SetPVarInt(playerid,"Despertador",0);
- return 1;
- }
- else if(GetPVarInt(playerid,"Despertador") == -1)
- {
- SendClientMessage(playerid, -1, "Você ainda não iniciou o Despertador, Digite: /desp [hora] [min] [seg]");
- }
- return 1;
- }
- forward DESPERTADOR_Update(playerid);
- public DESPERTADOR_Update(playerid)
- {
- new string[50], string2[16];
- if(GetPVarInt(playerid,"Despertador") == 1)
- {
- gettime(P_TIME[0], P_TIME[1], P_TIME[2]);
- if(D_TIME[0] == P_TIME[0] && D_TIME[1] == P_TIME[1] && D_TIME[2] == P_TIME[2])
- {
- format(string, sizeof(string), "DESPERTADOR: %02d:%02d:%02d", D_TIME[0], D_TIME[1], D_TIME[2]);
- SendClientMessage(playerid, -1, string);
- PlayerTextDrawShow(playerid, DESP[playerid][0]);
- PlayerTextDrawShow(playerid, DESP[playerid][1]);
- PlayerTextDrawShow(playerid, DESP[playerid][2]);
- format(string2, 128, "%02d:%02d:%02d", P_TIME[0], P_TIME[1], P_TIME[2]);
- PlayerTextDrawSetString(playerid, DESP[playerid][1], string2);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement