[Include] Times (Game Time)
#1

Hi all this include sets game time for players like 1:00 2:00 3:00 ....
And it sets days, night, morning... depends what time

types
Code:
//TIMES_GAME_TIME - counts 1 minute in 6 seconds
//TIMES_REAL_TIME - counts 1 minute in 60 seconds
//TIMES_WEEKS - counts 7 days on 8th day reset back to 1st day so you can make script like sunday monday tuesday ...
//TIMES_DAYS - counts days
commdans:

PHP Code:
//game time wich is same for all players
SetDays(days)  //set game days
SetHours(hours)  //set game hours
SetMinutes(minutes)  //set game minutes
SetSeconds(seconds)  //set game seconds
GetDays()  //gets game days
GetHours()  //gets game hours
GetMinutes()  //gets game minutes
GetSeconds()  //gets game seconds
StartTime(typeweek_type//start to count game time
EndTime()  //ends count game time / can be used to pause too
ResetTime()  //reset game time to 0
SetRealTime(playerid)  //changing the game day, night, morning depends what time
//player time wich each player has it own time
SetPlayerDays(playeriddays)  //set player days
SetPlayerHours(playeridhours)  //set player hours
SetPlayerMinutes(playeridminutes)  //set player minutes
SetPlayerSeconds(playeridseconds)  //set player seconds
GetPlayerDays(playerid)  //gets player days
GetPlayerHours(playerid)  //gets player hours
GetPlayerMinutes(playerid)  //gets player minutes
GetPlayerSeconds(playerid)  //gets player seconds
StartPlayerTime(playeridtypeweek_type)  //start to count player time
EndPlayerTime(playerid)  //ends player time count / can used to pause too
ResetPlayerTime(playerid)  //reset player time to 0
SetPlayerRealTime(playerid)  //changing the player day, night, morning depends what time
/////////////types/////////////////////////////////
TIMES_GAME_TIME counts 1 minute in 6 seconds
TIMES_REAL_TIME 
counts 1 minute in 60 seconds
TIMES_WEEKS 
counts 7 days on 8th day reset back to 1st day so you can make script like sunday monday tuesday ...
TIMES_DAYS counts days
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
tutorial for game time(wich is for all players):

PHP Code:
#include <a_samp>
#include <Times>
#include <zcmd>
#if defined FILTERSCRIPT
#endif
//TIMES_GAME_TIME - counts 1 minute in 6 seconds
//TIMES_REAL_TIME - counts 1 minute in 60 seconds
//TIMES_WEEKS - counts 7 days on 8th day reset back to 1st day so you can make script like sunday monday tuesday ...
//TIMES_DAYS - counts days
public OnFilterScriptInit()
{
    
StartTime(TIMES_GAME_TIMETIMES_WEEKS); //start game to count time 
    
SetDays(3); //set days to 3
    
SetHours(12); //set hours to 12 if you want to set to 12 am: SetHours(24);
    
SetMinutes(30); //set minutes to 30
    
SetSeconds(15);  //set seconds tp 15
    
SetRealTime(); //SetRealTime is changing the (day, night, morning depends what time)
    
return 1;
}
public 
OnFilterScriptExit()
{
    
EndTime(); //end count
    
return 1;
}
public 
OnGameModeInit()
{
    
StartTime(TIMES_REAL_TIMETIMES_DAYS);
    return 
1;
}
public 
OnGameModeExit()
{
    
EndTime();
    return 
1;
}
CMD:gett(playeridparams[])
{
    new 
Str[64];
    if(
GetHours() <= 23 || GetHours() >= 1)
    {
       
format(Strsizeof(Str), "%02d:%02d:%02d:%02d"GetDays(), GetHours(), GetMinutes(), GetSeconds());
       
SendClientMessage(playerid0x00FF00FFStr);
    }
    if(
GetHours() == 24//if 12 am display as 00.
    
{
       
format(Strsizeof(Str), "%02d:00:%02d:%02d"GetDays(), GetMinutes(), GetSeconds());
       
SendClientMessage(playerid0x00FF00FFStr);
    }
    return 
1;
}
CMD:later(playeridparams[])
{
    
SetDays(GetDays()+1); //set next day.
    
SetHours(GetHours()+1); //set next hour.
    
SetMinutes(GetMinutes()+1); //set next minute.
    
SetSeconds(GetSeconds()+1); //set next second.
    
return 1;
}
CMD:resett(playeridparams[])
{
    
ResetTime();
    
SetDays(1); //if weeks
    
return 1;
}
CMD:pauset(playeridparams[])
{
    
EndTime(); //ends also pause time
    
return 1;
}
CMD:resume(playeridparams[])
{
    
StartTime(TIMES_GAME_TIMETIMES_WEEKS); //starts time // if stoped can call it resume
    
return 1;

tutorial for player time:
PHP Code:
#include <a_samp>
#include <Times>
#include <zcmd>
#if defined FILTERSCRIPT
#endif
//TIMES_GAME_TIME - counts 1 minute in 6 seconds
//TIMES_REAL_TIME - counts 1 minute in 60 seconds
//TIMES_WEEKS - counts 7 days on 8th day reset back to 1st day so you can make script like sunday monday tuesday ...
//TIMES_DAYS - counts days
public OnPlayerConnect(playerid)
{
    
StartPlayerTime(playeridTIMES_GAME_TIMETIMES_WEEKS); //start player time to count
    
SetPlayerDays(playerid3); //set player days to 3
    
SetPlayerHours(playerid12); //set player hours to 12 if you want to set to 12 am: SetHours(24);
    
SetPlayerMinutes(playerid30); //set player minutes to 30
    
SetPlayerSeconds(playerid15);  //set player seconds t 15
    
SetPlayerRealTime(playerid); //SetPlayerRealTime is changing the (day, night, morning depends what time) for player
    
return 1;
}
public 
OnPlayerDisconnect(playerid)
{
    
EndPlayerTime(playerid); //end player count
    
return 1;
}
CMD:getmyt(playeridparams[])
{
    new 
Str[64];
    if(
GetPlayerHours(playerid) <= 23 || GetPlayerHours(playerid) >= 1)
    {
       
format(Strsizeof(Str), "%02d:%02d:%02d:%02d"GetPlayerDays(playerid), GetPlayerHours(playerid), GetPlayerMinutes(playerid), GetPlayerSeconds(playerid));
       
SendClientMessage(playerid0x00FF00FFStr);
    }
    if(
GetPlayerHours(playerid) == 24//if 12 am display as 00.
    
{
       
format(Strsizeof(Str), "%02d:00:%02d:%02d"GetPlayerDays(playerid), GetPlayerMinutes(playerid), GetPlayerSeconds(playerid));
       
SendClientMessage(playerid0x00FF00FFStr);
    }
    return 
1;
}
CMD:laterp(playeridparams[])
{
    
SetPlayerDays(playeridGetPlayerDays(playerid)+1); //set player next day.
    
SetPlayerHours(playeridGetPlayerHours(playerid)+1); //set player next hour.
    
SetPlayerMinutes(playeridGetPlayerMinutes(playerid)+1); //set player next minute.
    
SetPlayerSeconds(playeridGetPlayerSeconds(playerid)+1); //set player next second.
    
return 1;
}
CMD:pauset(playeridparams[])
{
    
EndPlayerTime(playerid); //ends player time also pause  player time
    
return 1;
}
CMD:resettp(playeridparams[])
{
    
ResetPlayerTime(playerid);
    
SetPlayerDays(playerid1); //if weeks
    
return 1;
}
CMD:resume(playeridparams[])
{
    
StartPlayerTime(playeridTIMES_GAME_TIMETIMES_WEEKS); //starts player time // if stoped can call it resumes player time
    
return 1;

pastebin: http://pastebin.com/jmvRdMq6

full package: https://www.solidfiles.com/v/ZBnvQmz3qQjGY

[ame]http://m.youtube.com/watch?v=-l7pPx6KTDg[/ame]
Reply
#2

i need help guys
Reply
#3

Quote:
Originally Posted by mohamedessam
View Post
i need help guys
Really easy to help you without knowing what your problem is.
Reply
#4

Quote:
Originally Posted by JustMe.77
View Post
Really easy to help you without knowing what your problem is.
Clearly he needs help writing his question.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)