Raised This Month: $ Target: $400
 0% 

Trie for every player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
reinert
Veteran Member
Join Date: Feb 2007
Old 05-06-2011 , 14:56   Re: Trie for every player
Reply With Quote #5

Thanks ConnorMcLeod, Your code is more humanlike and more understandable for me, thanks, but when I change map and enter server then I want to open /menu and It says I've already opened it before, and I've to wait 5minutes.

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Plugin name"
#define VERSION "1.0"
#define AUTHOR "author"

new Trie:g_tPlayerAbility


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu""CmdMenu")
    
    
g_tPlayerAbility TrieCreate()
}

public 
CmdMenu(id)
{
    if(
HasUserAbility(id))
    {
        new 
szSteamID[32]
        
get_user_authid(idszSteamIDcharsmax(szSteamID))
        
TrieSetCell(g_tPlayerAbilityszSteamIDget_systime() + 300)
        
//ShowMenu(id)
    
}
    else
    {
    
client_print(idprint_chat"you can use menu only every 5 minutes")
    }
}

bool:HasUserAbility(id)
{
    new 
iExpireTimeszSteamID[32]
    
get_user_authid(idszSteamIDcharsmax(szSteamID))
    if( 
TrieGetCell(g_tPlayerAbilityszSteamIDiExpireTime) )
    {
        if( 
iExpireTime get_systime() )
        {
            return 
false
        
}
        
TrieDeleteKey(g_tPlayerAbilityszSteamID)
    }
    return 
true
}

public 
plugin_end( )
{
    
TrieDestroyg_tPlayerAbility );


Last edited by reinert; 05-06-2011 at 15:34.
reinert 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 04:25.


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