[Pedido] Salvar hora && minuto && segundos
#3

Eu uso a include do Gammix's (easydb.inc)

para salvar
PHP код:
stock SaveData(playerid)
{
    new 
key DB::RetrieveKey(gGlobal[TKT_UserTable], "username"tkPlayerName(playerid));
    if(
key != DB_INVALID_KEY)
    {
        if(
GetPVarInt(playerid"TKAdmin_Loggedin") != PLAYER_VARTYPE_NONE)
        {
            new 
DATE[18], date[3];
            
getdate(date[0], date[1], date[2]);
            
format(DATEsizeof(DATE), "%i/%i/%i"date[2], date[1], date[0]);
            
GetPlayerConnectedTime(playeridtkUSER[playerid][TKU_Hours], tkUSER[playerid][TKU_Minutes], tkUSER[playerid][TKU_Seconds]);
            
DB::SetStringEntry(gGlobal[TKT_UserTable],key,         "laston",         DATE);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "kicked",         tkUSER[playerid][TKU_Kicked]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "jailed",         tkUSER[playerid][TKU_Jailed]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "jailtime",     tkUSER[playerid][TKU_JailedTime]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "muted",         tkUSER[playerid][TKU_Muted]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "mutetime",     tkUSER[playerid][TKU_MutedTime]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "cmuted",         tkUSER[playerid][TKU_CMuted]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "cmutetime",     tkUSER[playerid][TKU_CMuteTime]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "cash",         tkUSER[playerid][TKU_Cash]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "level",         tkUSER[playerid][TKU_pLevel]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "kills",         tkUSER[playerid][TKU_Kills]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "deaths",         tkUSER[playerid][TKU_Deaths]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "score",         GetPlayerScore(playerid));
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "money",         GetPlayerMoney(playerid));
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "hours",         tkUSER[playerid][TKU_Hours]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "minutes",         tkUSER[playerid][TKU_Minutes]);
            
DB::SetIntEntry(gGlobal[TKT_UserTable], key,         "seconds",         tkUSER[playerid][TKU_Seconds]);
        
        }
    }
    return 
1;

para carregar
PHP код:
new key DB::RetrieveKey(gGlobal[TKT_UserTable], "username"tkPlayerName(playerid));
            new 
hash[65];
            
DB::Hash(hashsizeof(hash), inputtext);
            new 
password[128];
            
            
DB::GetStringEntry(gGlobal[TKT_UserTable], key"password"password);
            if(! 
strcmp(hashpassword))
            {
                
tkUSER[playerid][TKU_Kicked] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"kicked");
                
tkUSER[playerid][TKU_Admin] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"admin");
                
tkUSER[playerid][TKU_VIP] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"vip");
                
tkUSER[playerid][TKU_Kills] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"kills");
                
tkUSER[playerid][TKU_Deaths] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"deaths");
                
tkUSER[playerid][TKU_Score] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"score");
                
tkUSER[playerid][TKU_Money] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"money");
                
tkUSER[playerid][TKU_Hours] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"hours");
                
tkUSER[playerid][TKU_Minutes] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"minutes");
                
tkUSER[playerid][TKU_Seconds] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"seconds");
                
tkUSER[playerid][TKU_Jailed] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"jailed");
                
tkUSER[playerid][TKU_pLevel] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"level");
                
tkUSER[playerid][TKU_JailedTime] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"jailtime");
                
tkUSER[playerid][TKU_Muted] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"muted");
                
tkUSER[playerid][TKU_MutedTime] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"mutetime");
                
tkUSER[playerid][TKU_CMuted] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"cmuted");
                
tkUSER[playerid][TKU_CMuteTime] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"cmutetime");
                
tkUSER[playerid][TKU_Cash] = DB::GetIntEntry(gGlobal[TKT_UserTable], key"cash"); 
conversor
PHP код:
stock GetPlayerConnectedTime(playerid, &hours, &minutes, &seconds)
{
    new 
connected_time NetStats_GetConnectedTime(playerid);
    
seconds = (connected_time 1000) % 60;
    
minutes = (connected_time / (1000 60)) % 60;
    
hours = (connected_time / (1000 60 60));
    return 
true;

Reply


Messages In This Thread
Salvar hora && minuto && segundos - by F1N4L - 04.01.2016, 21:20
Re: Salvar hora && minuto && segundos - by Coringa_Vilao - 04.01.2016, 21:49
Re: Salvar hora && minuto && segundos - by F1N4L - 04.01.2016, 22:03
Re: Salvar hora && minuto && segundos - by Coringa_Vilao - 04.01.2016, 22:04
Re: Salvar hora && minuto && segundos - by F1N4L - 04.01.2016, 22:06
Re: Salvar hora && minuto && segundos - by Coringa_Vilao - 04.01.2016, 22:08
Re: Salvar hora && minuto && segundos - by F1N4L - 04.01.2016, 22:10
Re: Salvar hora && minuto && segundos - by Coringa_Vilao - 04.01.2016, 22:29
Re: Salvar hora && minuto && segundos - by F1N4L - 04.01.2016, 22:36
Re: Salvar hora && minuto && segundos - by EditPawn - 05.01.2016, 01:33

Forum Jump:


Users browsing this thread: 1 Guest(s)