Raised This Month: $ Target: $400
 0% 

Finish plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MagNeto
Member
Join Date: May 2009
Old 07-20-2009 , 11:59   Finish plugin
Reply With Quote #1

If an user is bland, please help me with this:
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < nvault >

new Float:g_onlinetime 33 ],g_maxplayers,Vault,PlayerPoints 33 ],gVault,gAuthId 33 ] [ 40 ],saytext;

static const 
VAULTNAME [ ] = "pinfo"

public plugin_init ( )
{
    
register_plugin "HNS Top","0.1","MagNeto" )
    
register_event "SendAudio","end","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw" );
    
register_event "DeathMsg""death_event""a" )

    
g_maxplayers get_maxplayers ( )
    
saytext get_user_msgid "SayText" )


    
gVault nvault_open "HNS_TOP" )
}
public 
client_connect id )
{
    
get_user_authid id,gAuthId id ],39 )
    
ps_load_points id )
}
public 
client_disconnect id )
{
    
ps_save_points id )
}

    
public 
plugin_end ( )
{
    new 
Float:gametime get_gametime ( )
    for ( new 
id 1id <= g_maxplayers;id++ )
        if ( 
is_user_connected id ) && !is_user_bot id ) )
        {
            
updateUser id,0,0,floatround gametime g_onlinetime id ] ) )
            
g_onlinetime id ] = gametime
        
}
    
nvault_close gVault )
}
public 
end ( )
{
    new 
Float:gametime get_gametime ( )
    for ( new 
id 1id <= g_maxplayers;id++ )
        if ( 
is_user_connected id ) && !is_user_bot id ) )
        {
            
updateUser id,1,0,floatround gametime g_onlinetime id ] ) )
            
g_onlinetime id ] = gametime
        
}
}
public 
client_putinserver id )
{
    if ( !
is_user_bot id ) )
        
updateUser id,0,0,floatround get_gametime ( ) - g_onlinetime id ] ) )
    
g_onlinetime id ] - 0.0
}
updateUseridroundsconnectstime 
{
    new 
said 192 ]
    
read_args said,191 )
    
remove_quotes said )
    if ( ( 
containi said,"/tophns") != -) )
    {
        new 
info ],szName 33 ], data ]
        
data ] = id

        parse 
said,info,6,szName,31 )
        if ( 
equali info,"/tophns" ) )
        {
            if ( 
equal szName ],"" ) )
                
data ] = id

    Vault 
nvault_open VAULTNAME )
    if ( 
Vault == INVALID_HANDLE )
    {
               
server_print"Error opening nVault file: %s",VAULTNAME )
    }
    else 
    {
        new 
steamid 32 ],playerinfo ] [ 32 
        new 
key 32 ],val 511 ],TimeStamp

        get_user_authid 
id,steamid,31 )
        
formatkey,32,"%s",steamid )

        if( 
nvault_lookup Vaultkeyval510TimeStamp ) ) 
        {
            
parse valplayerinfo ], 31playerinfo ], 31playerinfo ], 31playerinfo ], 31 )
            new 
update 511 ]
            
rounds += str_to_num playerinfo ] )
            
connects += str_to_num playerinfo ] )
            
time += str_to_num playerinfo ] )
            
formatupdate,510,"^"%s^" %i %i %i",playerinfo ], roundsconnectstime )
            
nvault_set Vaultkeyupdate )
        }
        else 
        {
            new 
update 511 ], szName32 ]
            
get_user_name idszName31 )
            
format update,510,"^"%s^" %i %i %i",szName,0,1,)
            
nvault_set Vaultkeyupdate )

            new 
g_Nlen menu_create "\rTOP HNS:","tophnssettings" )

            
menu_additem g_Nlen,"\w#NICK | TIMP | PUNCTE","1",)
            
menu_additem g_Nlen,"\w%s | %s | %s,"2",0,szName,update,PlayerPoints )
            menu_additem ( g_Nlen,"
\w%| %| %s,"3",0,szName,update,PlayerPoints )
            
menu_additem g_Nlen,"\w%s | %s | %s,"4",0,szName,update,PlayerPoints )
            menu_additem ( g_Nlen,"
\w%| %| %s,"5",0,szName,update,PlayerPoints )
            
menu_additem g_Nlen,"\w%s | %s | %s,"6",0,szName,update,PlayerPoints )
            menu_additem ( g_Nlen,"
\w%| %| %s,"7",0,szName,update,PlayerPoints )
            
menu_additem g_Nlen,"\w%s | %s | %s,"8",0,szName,update,PlayerPoints )
            menu_additem ( g_Nlen,"
\w%| %| %s,"9",0,szName,update,PlayerPoints )
            
menu_additem g_Nlen,"\w%s | %s | %s,"10",0,szName,update,PlayerPoints )
            menu_additem ( g_Nlen,"
\w%| %| %s,"11",0,szName,update,PlayerPoints )

            
menu_setprop g_Nlen,MPROP_EXIT,MEXIT_ALL )
    
            
menu_display id,menu,)
        }
        
nvault_close Vault )
    }
}
public 
tophnssettings id,g_Nlen,item )
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroy g_Nlen )
        return 
1
    
}
    new 
data ],iName 64 ]
    new 
accesscallback

    menu_item_getinfo 
g_Nlen,item,access,data,5,iName,63,callback )

    new 
key str_to_num data )

    switch ( 
key )
    {
        case 
1:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
2:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
3:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
4:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
5:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
6:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
7:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
8:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
9:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
        case 
10:
        {
            
menu_destroy g_Nlen )
            return 
1
        
}
    }
    
menu_destroy g_Nlen )
    return 
1
}    
public 
printUserInfo userids [ ] ) 

    new 
id userids ]
    new 
playerid userids ]
    
    
Vault nvault_open VAULTNAME )
    if ( 
Vault == INVALID_HANDLE )
    {
               
server_print("Error opening nVault file: %s",VAULTNAME)
    }
    else 
    {
        new 
steamid 32 ], playerinfo ][ 64 
        new 
key 32 ], val 511 ], TimeStamp
        
        get_user_authid 
playerid,steamid,31 )
        
formatkey,32,"%s",steamid )
        
        if ( 
nvault_lookup Vaultkeyval510TimeStamp ) ) 
        {
            
parse valplayerinfo ], 63playerinfo ], 63playerinfo ], 63playerinfo ], 63 )

            new 
Float:gametime get_gametime ( )
            new 
onlinetime floatround gametime g_onlinetime playerid ] )
            new 
ptime str_to_num(playerinfo ] ) + onlinetime
            
new days ptime 86400
            
new hours = ( ptime 3600 ) % 24
            
new minutes = ( ptime 60 ) % 60
            
new seconds ptime 60
            
new totaltime 64 ]
            new 
sday 16 ], shr 16 ], smin 16 ], ssec 16 ]
            
            
format sday,15,"%i Day%s ",days, ( days==1?"s":"" ) )
            
format shr,15,"%i Hr%s ",hours, ( hours==1?"s":"" ) )
            
format smin,15,"%i Min%s ",minutes, ( minutes==1?"s":"" ) )
            
format ssec,15,"%i Sec%s ",seconds, ( seconds==1?"s":"" ) )
            
format totaltime63"%s%s%s%s", ( days >= sday:"" ), ( hours >= shr:"" ), smin, ( hours == ssec:"" ) )
            
            
nvault_close Vault )
            
            
updateUser playerid00onlinetime )
            
g_onlinetime playerid ] = gametime
        
}
    }
    return 
PLUGIN_HANDLED
}
public 
death_event ( )
{
    new 
killer,victim;
        
    
killer read_data )
    
victim read_data )

    
selfkill = ( victim == killer || !is_user_connected killer ) ) true false
        
return
    
    
gPlayerPoints killer] +=5

    
}
ps_load_points id )
{
    new 
szData 32 ],iTimeStamp
    
    format 
szData,sizeof szData ) - 1,"%i",PlayerPoints id ] )
        
    
nvault_set gVaultgAuthIdid ], szData )

Errors:
PHP Code:
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(12) : error 088number of arguments does not match definition
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(13) : error 088number of arguments does not match definition
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(25) : error 017undefined symbol "ps_load_points"
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(29) : error 017undefined symbol "ps_save_points"
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(76) : warning 217loose indentation
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(109) : error 001expected token","but found "-integer value-"
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(109) : error 037invalid string (possibly non-terminated string)
/
home/groups/amxmodx/tmp3/phpd0xVAH.sma(109 -- 110) : warning 215expression has no effect
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(110) : error 001expected token","but found "-integer value-"
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(110) : fatal error 107too many error messages on one line 
Thanks.
Credits goes to: TitANious (for 'Ranks') & Alka (played time).
MagNeto is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 07-20-2009 , 12:06   Re: Finish plugin
Reply With Quote #2

What do you mean with "Bland"?

Btw. You need to format the

PHP Code:
menu_additem g_Nlen,"\w#NICK | TIMP | PUNCTE","1",)
            
menu_additem g_Nlen,"\w%s | %s | %s,"2",0,szName,update,PlayerPoints ) 
You can't use strings like that in a "Menu_Additem".
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Reply



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:16.


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