Raised This Month: $ Target: $400
 0% 

Need Help slottimer or a flag of your choice


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
no n@me
Junior Member
Join Date: Jun 2011
Old 06-30-2012 , 02:43   Need Help slottimer or a flag of your choice
Reply With Quote #1

I found this admintimer plugin, but does not work if you can help as little time there is no author on this plugin.
This plugin should give admins after some period of time player, but he gives odma as soon as they enter the server.
Commands:
/online- shows the player how much time is spent on the server
Cvars:
amx_admin_time
takes time to get a player admins (a value of hours); default: 350
and if possible add the time spent in the spec does not measure

amx_admin_flagsdefault: bcdefghij
if it is possible to add a cvar for the flags to give after a period of time(b or bcd)

amx_admin_daydefault: 30 day
if it is possible to add a cvar that after a certain period of time off admins



Installation:
Compile and put it in your plugins folder.
File timer.txt in data/lang folder.
Admin_timer.amxx line type in the file plugins.ini
Create file Admin.ini in configs folder.
Important:
Be sure to replace admin.amxx with those from zip file.


PHP Code:
// Plugin SLOT TIMER(Ovidius) - Editovan By : Acme - Admin Timer Kada igrac sakupi 350 sati daje mu admina// 
//Napominjem da se cvarom amx_admin_time "default 350" stavlja koliko treba igrac provesti vremena da dobije admina// 

#include <amxmodx> 
#include <amxmisc> 
#include <nvault> 
#include <hamsandwich> 
#include <time> 


#define PRUNE_TIME 2592000 

new Trie:g_tSteamIDs
new 
g_AdminFile[64], g_TotalTime[33]; 
new 
cvar_timerg_cached_time
new 
g_iMsgID_SayTextg_Vault

public 
plugin_init()  

    
register_plugin("Admin Timer""1.0","Ovidius // Edit : Acme"); 
    
register_cvar("amx_admin_time" "1.0" , (FCVAR_SERVER|FCVAR_SPONLY)) 
     
    
register_dictionary("timer.txt"
     
    
register_event("HLTV""NewRound""a""1=0""2=0"); 
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1
     
    
register_clcmd("say /online""TimeOnline"
    
cvar_timer register_cvar("amx_admin_time""350"
     
    
g_iMsgID_SayText get_user_msgid"SayText" ); 
     
    new 
configsDir[64]  
    
get_configsdir(configsDircharsmax(configsDir)) 
    
formatex(g_AdminFilecharsmax(g_AdminFile), "%s/admin.ini"configsDir)  
     
    
g_tSteamIDs TrieCreate(); 
     
    if( !
file_exists(g_AdminFile) )  
    { 
        new 
fopen(g_AdminFile"wt" ); 
        if( 
)  
        { 
            
fclose); 
        } 
        return; 
    } 
     
    new 
fopeng_AdminFile"rt" ); 
    if( !

        return; 
     
    while( !
feof) ) 
    { 
        new 
szData[200]; 
        
fgetsszData charsmaxszData ) ); 
         
        if( !
szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/' )  
            continue; 
         
        new 
szParsedName[33], szParsedID[35]; 
        
parse(szDataszParsedIDcharsmax(szParsedID), szParsedNamecharsmax(szParsedName)) 

        
TrieSetCellg_tSteamIDs szParsedID ); 
    } 
    
fclose);     


public 
plugin_cfg() 

    
g_Vault nvault_open("Time_played"
     
    if ( 
g_Vault == INVALID_HANDLE 
        
set_fail_state"Error opening nVault" ); 
         
    
nvault_prune(g_Vault0get_systime() - PRUNE_TIME); 


public 
TimeOnline(id

    new 
timepszTotalTime[128]; 
    
timep get_user_time(id1); 
    
get_time_length(idtimep+g_TotalTime[id], timeunit_secondsszTotalTimecharsmax(szTotalTime)); 
     
    
set_hudmessage(025500.340.5006.04.00.10.2, -1); 
    
show_hudmessage(id"[PT] %L"id"TIME_TOTAL_HUD"szTotalTime); 
    
ChatColor(id"^4[PT] ^1%L"id"TIME_TOTAL_HUD"szTotalTime

public 
fwHamPlayerSpawnPost(id)  

    if(!
is_user_alive(id) || is_user_admin(id)) 
        return 
PLUGIN_HANDLED
         
    new 
timep
    
timep get_user_time(id1); 
     
    if(
timep+g_TotalTime[id] >= g_cached_time
    { 
        new 
szSteamID35 ]; 
        
get_user_authidid szSteamID charsmaxszSteamID ) ); 
     
        if(!
TrieKeyExistsg_tSteamIDs szSteamID )) 
        { 
            new 
szWriteData[200], szName[33], szTotalTime[128]; 
             
            
get_user_name(idszNamecharsmax(szName)) 
            
get_time_length(idtimep+g_TotalTime[id], timeunit_secondsszTotalTimecharsmax(szTotalTime)); 
             
            
TrieSetCellg_tSteamIDs szSteamID );  
             
            
ChatColor(id"^4[PT] ^1%L"id"TIME_ONLINE"szTotalTime
            
format(szWriteDatacharsmax(szWriteData), "^"%s^"    ^"^"    ^"b^"    ^"abcdefghij^" // %s"szSteamIDszName
            
write_file(g_AdminFileszWriteData
             
            
server_cmd("amx_reloadadmins"
        } 
    } 
    return 
PLUGIN_CONTINUE


public 
NewRound() 
    
g_cached_time get_pcvar_num(cvar_timer)*60*60 

public client_disconnect(id

    
g_TotalTime[id] = g_TotalTime[id] + get_user_time(id); 
    
SaveTime(idg_TotalTime[id]); 


public 
client_putinserver(id
    
g_TotalTime[id] = LoadTime(id); 

public 
LoadTimeid )  

    new 
szSteamID[35]; 
    new 
vaultkey[128], vaultdata[128]; 
     
    
get_user_authid(idszSteamIDcharsmaxszSteamID )); 
     
    
formatex(vaultkeycharsmax(vaultkey), "TIMEPLAYED%s"szSteamID); 
     
    
nvault_get(g_Vaultvaultkeyvaultdatacharsmax(vaultdata)); 
     
    return 
str_to_num(vaultdata); 


public 
SaveTime(id,PlayedTime

    new 
szSteamID[35]; 
    new 
vaultkey[128], vaultdata[128]; 
    
formatex(vaultdatacharsmax(vaultdata), "%d"PlayedTime);  
     
    
get_user_authid(idszSteamIDcharsmaxszSteamID )); 
     
    
formatex(vaultkeycharsmax(vaultkey), "TIMEPLAYED%s"szSteamID);  
     
    
nvault_set(g_Vaultvaultkeyvaultdata); 


public 
plugin_end() 

    
nvault_close(g_Vault); 
    
TrieDestroy(g_tSteamIDs


stock ChatColor(const id, const input[], any:...) 

    new 
count 1players[32
    static 
msg[191
    
vformat(msg190input3
     
    
replace_all(msg190"!g""^4"// Green Color 
    
replace_all(msg190"!y""^1"// Default Color 
    
replace_all(msg190"!t""^3"// Team Color 
     
    
if (idplayers[0] = id; else get_players(playerscount"ch"
    { 
        for (new 
0counti++) 
        { 
            if (
is_user_connected(players[i])) 
            { 
                
message_begin(MSG_ONE_UNRELIABLEg_iMsgID_SayText_players[i]) 
                
write_byte(players[i]); 
                
write_string(msg); 
                
message_end(); 
            } 
        } 
    } 

Attached Files
File Type: zip admin timer.zip (39.7 KB, 57 views)

Last edited by no n@me; 06-30-2012 at 02:51.
no n@me is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:16.


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