GodPlay Clan - eVolution Gaming Technology By Killer*Elite
Doriți să reacționați la acest mesaj? Creați un cont în câteva clickuri sau conectați-vă pentru a continua.

GodPlay Clan - eVolution Gaming Technology By Killer*Elite


 
AcasaPortalUltimele imaginiCăutareConectareÎnregistrare
Subiecte similare

Distribuiţi | 
 

 [PLUGIN] Ore Jucate

Vezi subiectul anterior Vezi subiectul urmator In jos 
AutorMesaj
Killer*Elite
Admin
Admin
Killer*Elite

Membru din Membru din : 14/07/2010
Mesaje Mesaje : 450
Localizare Localizare : Romania
Reputatie Reputatie : 27

[PLUGIN] Ore Jucate Empty
MesajSubiect: [PLUGIN] Ore Jucate   [PLUGIN] Ore Jucate Icon_minitimeDum Dec 19, 2010 8:23 am

Descriere: Acest plugin afiseaza timpul total cat ati jucat pe server.
Autor: aNNakin



[Trebuie sa fiti inscris si conectat pentru a vedea acest link]





Sursa Plugin:
Citat :
#include
#include

#define _vault_dir "addons/amxmodx/data/file_vault"

new const gs_VaultName[ ] = "PlayedTime";

new gi_PlayedTime[ 33 ];

public plugin_init ( )
{
register_plugin("Ore Jucate","1.0","aNNakin")
register_clcmd ( "say /orejucate", "playedtime_cmd" );
register_clcmd ( "say /timpjucat", "playedtime_cmd" );

}

public client_disconnect ( id )
SaveTime ( id );
public client_putinserver ( id )
LoadTime ( id );

public SaveTime ( id )
{
gi_PlayedTime[ id ] = get_user_time ( id );

new s_Name[ 32 ], s_Data[ 16 ];
get_user_name ( id, s_Name, 31 );
num_to_str ( gi_PlayedTime[ id ], s_Data, charsmax ( s_Data ) );

fvault_set_data ( gs_VaultName, s_Name, s_Data );
}

public LoadTime ( id )
{
new s_Name[ 32 ], s_Data[ 16 ];
get_user_name ( id, s_Name, 31 );

if ( fvault_get_data ( gs_VaultName, s_Name, s_Data, charsmax ( s_Data ) ) )
gi_PlayedTime[ id ] = str_to_num ( s_Data );
else
gi_PlayedTime[ id ] = 0;
}

public playedtime_cmd ( id )
{
new i_Total = gi_PlayedTime[ id ] get_user_time ( id );

if ( i_Total < 60 )
client_print ( id, print_chat, "[NovusLinK.Ro]Timpul Total Jucat: %d secunde", i_Total );
else if ( i_Total >= 60 && i_Total < 3600 )
client_print ( id, print_chat, "[NovusLinK.Ro]Timpul Total Jucat: %d minute", ( i_Total / 60 ) );
else if ( i_Total >= 3600 )

client_print ( id, print_chat, "[NovusLinK.Ro]Timpul Total Jucat:
%d ore si %d minute", ( i_Total / 3600 ), ( i_Total % 3600 ) );

return 0;
}

// - - -

fvault_set_data(const vaultname[], const key[], const data[])
{
static const temp_vault_name[] = "fvault_set_data.txt";

new file = fopen(temp_vault_name, "wt");

new filename[128];
_FormatVaultName(vaultname, filename, sizeof(filename) - 1);

new vault = fopen(filename, "rt");

new _data[512], _key[64], _other[3];

new bool:replaced = false;

while( !feof(vault) )
{
fgets(vault, _data, sizeof(_data) - 1);
parse(_data, _key, sizeof(_key) - 1, _other, sizeof(_other) - 1);

if( equal(_key, key) && !replaced )
{
fprintf(file, "^"%s^" ^"%s^"^n", key, data);

replaced = true;
}
else
{
fputs(file, _data);
}
}

if( !replaced )
{
fprintf(file, "^"%s^" ^"%s^"^n", key, data);
}

fclose(file);
fclose(vault);

delete_file(filename);

while( !rename_file(temp_vault_name, filename, 1) ) { }

//delete_file(temp_vault_name);
}

fvault_get_data(const vaultname[], const key[], data[], len)
{
new filename[128];
_FormatVaultName(vaultname, filename, sizeof(filename) - 1);

new vault = fopen(filename, "rt");

new _data[512], _key[64];

while( !feof(vault) )
{
fgets(vault, _data, sizeof(_data) - 1);
parse(_data, _key, sizeof(_key) - 1, data, len);

if( equal(_key, key) )
{
fclose(vault);

return 1;
}
}

fclose(vault);

copy(data, len, "");

return 0;
}

_FormatVaultName(const vaultname[], filename[], len)
{
static const invalid_chars[][] =
{
"/", "", "*", ":", "?", "^"", "<", ">", "|"
};

static tempvault[128], i;
copy(tempvault, sizeof(tempvault) - 1, vaultname);

for( i = 0; i < sizeof(invalid_chars); i )
{
replace(tempvault, sizeof(tempvault) - 1, invalid_chars[i], "");
}

if( !dir_exists(_vault_dir) )
{
mkdir(_vault_dir);
}

formatex(filename, len, "%s/%s.txt", _vault_dir, tempvault);
}
Sus In jos
http://godplay.to-relax.net
 

[PLUGIN] Ore Jucate

Vezi subiectul anterior Vezi subiectul urmator Sus 

 Subiecte similare

+
Pagina 1 din 1

Permisiunile acestui forum:Nu puteti raspunde la subiectele acestui forum
GodPlay Clan - eVolution Gaming Technology By Killer*Elite :: TUTORIALE SI RESURSE COUNTER-STRIKE :: Pluginuri AmxModX-
Mergi direct la: