AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Played time HUD (https://forums.alliedmods.net/showthread.php?t=225486)

raducuursu 09-05-2013 10:54

Played time HUD
 
Somebody help me get in HUD Played time

I already included plugin put time played after (Welcome,% s ^ NWE hope you `ll enjoy you stay here! ^ n ^ n% s ^ n% s ^ nYou rank is from% s ^ n ^ nTime Played:) ;

PHP Code:

#include < amxmodx > 
#include < csstats >
#include < dhudmessage >
#include <Commas>
#include <nvault>
#include <time>

#define PLUGIN_VERSION    "1.0.0"

new gHostName;
new 
output[64], key[33][32], vault;


public 
plugin_init( )
{
    
register_plugin"Connect Info Hud""1.0.1""4fun" );
    
    
gHostName get_cvar_pointer"hostname" );
    
register_clcmd("say /h""getPlayTime");
    
register_dictionary("time.txt");
    
vault nvault_open("playtimes");
    if (
vault == INVALID_HANDLE)
        
set_fail_state("Error opening nVault");
}

public 
client_putinserverid )
{
    if( 
is_user_botid ) ) 
        return;
        
    
set_task13.0"go_info"id );
    
set_task24.0"fav"id )
}

public 
go_infoid )
{
    new 
s_HostName64 ];
    
get_pcvar_stringgHostNames_HostNamecharsmaxs_HostName ) );
    
    static 
s_Name 32 ];
    
get_user_nameids_Namecharsmax s_Name ) );

        static 
stats], body];
    new 
s_RankPos get_user_stats idstatsbody );
    new 
s_MaxRank get_statsnum ( );
    
        static 
rankposString[16], maxrankString[16];
        
AddCommas(s_RankPosrankposString15);
        
AddCommas(s_MaxRankmaxrankString15);

        
set_dhudmessage20255200.100.2426.08.0 );
    
show_dhudmessageid"Welcome, %s^nWe hope you enjoy you`ll stay here!^n^n%s^n^nYou rank is %s from %s"s_Names_HostNamerankposStringmaxrankString );
}

public 
fav(id)
{
    new 
s_HostName64 ];
    
get_pcvar_stringgHostNames_HostNamecharsmaxs_HostName ) );

        
set_dhudmessage100202500.130.7026.08.0 )
        
show_dhudmessageid"%s^nDon't forget to add us to your favourites."s_HostName )
}

public 
getPlayTime(id) {
    
get_time_length(id, (get_user_time(id) + nvault_get(vaultkey[id])), timeunit_seconds output63);
    
client_print(idprint_chat"Your accumulated time is: %s"output);
}

public 
client_authorized(id) {
    
get_user_authid(idkey[id], 31);
    
nvault_touch(vaultkey[id]);
}

public 
client_disconnect(id) {
    new 
value[33], timestamp;
    
nvault_lookup(vaultkey[id], value32timestamp);
    
formatex(value32"%d", ((time() - timestamp) + nvault_get(vaultkey[id])));
    
nvault_set(vaultkey[id], value);
}

public 
plugin_end() {
    
nvault_close(vault);



3xit. 09-17-2013 08:58

Re: Played time HUD
 
I don't understand what your trying to do?

You added HUD messages in the other... Add this in getPlayTime(id)

PHP Code:

set_dhudmessage100202500.130.7026.08.0 ) [/COLOR]
show_dhudmessageid"Your accumulated time is: %s"output); 


Alider 11-14-2013 05:32

Re: Played time HUD
 
commas??? yo don't have commas.inc ?


All times are GMT -4. The time now is 18:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.