Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //US_Timers inc made by UltraScripter ///////////////////////////// ///// //////////////////////////////////////////////////////////////
- //US_Timers inc made by UltraScripter ///////////////////////////// ///// //////////////////////////////////////////////////////////////
- /*
- native US_SetTimer(playerid, type);
- native US_ResetTimer(playerid);
- native US_SetCountDown(playerid, type);
- native US_SetTimerAdd(playerid, type, days, hours, minutes, seconds);
- native US_GetSecs(playerid);
- native US_GetMins(playerid);
- native US_GetHours(playerid);
- native US_GetDays(playerid);
- native US_SetTimerTime(playerid, days, hours, minutes, seconds);
- */
- #if defined _US_Timers_included
- #endinput
- #define US_timers_included
- #endif
- new USTIMERSSEC[MAX_PLAYERS]; //1000
- new USTIMERSMIN[MAX_PLAYERS]; //60000
- new USTIMERSHOUR[MAX_PLAYERS]; //3600000
- new USTIMERSDAY[MAX_PLAYERS]; //86400000
- #define SEC 0
- #define MIN 1
- #define HOUR 2
- #define DAY 3
- stock US_SetTimer(playerid, type)
- {
- if(type == SEC)
- {
- SetTimerEx("USTIMERSECPUB", 1000, true, "i", playerid);
- }
- if(type == MIN)
- {
- SetTimerEx("USTIMERMINPUB", 60000, true, "i", playerid);
- }
- if(type == HOUR)
- {
- SetTimerEx("USTIMERHOURPUB", 3600000, true, "i", playerid);
- }
- if(type == DAY)
- {
- SetTimerEx("USTIMERDAYPUB", 8400000, true, "i", playerid);
- }
- return 1;
- }
- stock US_ResetTimer(playerid)
- {
- USTIMERSSEC[playerid] = 0;
- USTIMERSMIN[playerid] = 0;
- USTIMERSHOUR[playerid] = 0;
- USTIMERSDAY[playerid] = 0;
- return 1;
- }
- stock US_SetCountDown(playerid, type)
- {
- if(type == SEC)
- {
- SetTimerEx("SUBUSTIMERSECPUB", 1000, true, "i", playerid);
- }
- if(type == MIN)
- {
- SetTimerEx("SUBUSTIMERMINPUB", 60000, true, "i", playerid);
- }
- if(type == HOUR)
- {
- SetTimerEx("SUBUSTIMERHOURPUB", 3600000, true, "i", playerid);
- }
- if(type == DAY)
- {
- SetTimerEx("SUBUSTIMERDAYPUB", 8400000, true, "i", playerid);
- }
- return 1;
- }
- stock US_SetTimerAdd(playerid, days, hours, minutes, seconds)
- {
- USTIMERSSEC[playerid] += seconds;
- USTIMERSMIN[playerid] += minutes;
- USTIMERSHOUR[playerid] += hours;
- USTIMERSDAY[playerid] += days;
- return 1;
- }
- stock US_SetTimerTime(playerid, days, hours, minutes, seconds)
- {
- USTIMERSSEC[playerid] = seconds;
- USTIMERSMIN[playerid] = minutes;
- USTIMERSHOUR[playerid] = hours;
- USTIMERSDAY[playerid] = days;
- return 1;
- }
- forward USTIMERSECPUB(playerid);
- public USTIMERSECPUB(playerid)
- {
- USTIMERSSEC[playerid] += 1;
- if(USTIMERSSEC[playerid] == 60) return USTIMERSSEC[playerid] = 0;
- return 1;
- }
- forward USTIMERMINPUB(playerid);
- public USTIMERMINPUB(playerid)
- {
- USTIMERSMIN[playerid] += 1;
- if(USTIMERSMIN[playerid] == 60) return USTIMERSMIN[playerid] = 0;
- return 1;
- }
- forward USTIMERHOURPUB(playerid);
- public USTIMERHOURPUB(playerid)
- {
- USTIMERSHOUR[playerid] += 1;
- if(USTIMERSHOUR[playerid] == 60) return USTIMERSHOUR[playerid] = 0;
- return 1;
- }
- forward USTIMERDAYPUB(playerid);
- public USTIMERDAYPUB(playerid)
- {
- USTIMERSDAY[playerid] += 1;
- return 1;
- }
- forward SUBUSTIMERSECPUB(playerid);
- public SUBUSTIMERSECPUB(playerid)
- {
- USTIMERSSEC[playerid] -= 1;
- if(USTIMERSSEC[playerid] == 0) return USTIMERSSEC[playerid] = 59;
- if(USTIMERSSEC[playerid] == 60) return USTIMERSSEC[playerid] = 0;
- return 1;
- }
- forward SUBUSTIMERMINPUB(playerid);
- public SUBUSTIMERMINPUB(playerid)
- {
- USTIMERSMIN[playerid] -= 1;
- if(USTIMERSMIN[playerid] == 0) return USTIMERSMIN[playerid] = 59;
- if(USTIMERSMIN[playerid] == 60) return USTIMERSMIN[playerid] = 0;
- return 1;
- }
- forward SUBUSTIMERHOURPUB(playerid);
- public SUBUSTIMERHOURPUB(playerid)
- {
- USTIMERSHOUR[playerid] -= 1;
- if(USTIMERSHOUR[playerid] == 0) return USTIMERSHOUR[playerid] = 59;
- if(USTIMERSHOUR[playerid] == 60) return USTIMERSHOUR[playerid] = 0;
- return 1;
- }
- forward SUBUSTIMERDAYPUB(playerid);
- public SUBUSTIMERDAYPUB(playerid)
- {
- USTIMERSDAY[playerid] -= 1;
- return 1;
- }
- stock US_GetSecs(playerid)
- {
- return USTIMERSSEC[playerid];
- }
- stock US_GetMins(playerid)
- {
- return USTIMERSMIN[playerid];
- }
- stock US_GetHours(playerid)
- {
- return USTIMERSHOUR[playerid];
- }
- stock US_GetDays(playerid)
- {
- return USTIMERSDAY[playerid];
- }
- //US_Timers inc made by UltraScripter ///////////////////////////// ///// //////////////////////////////////////////////////////////////
- //US_Timers inc made by UltraScripter ///////////////////////////// ///// //////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment