Member
|
07-20-2009
, 11:59
Finish plugin
|
#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 = 1; id <= 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 = 1; id <= 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 } updateUser( id, rounds, connects, time ) { new said [ 192 ] read_args ( said,191 ) remove_quotes ( said ) if ( ( containi ( said,"/tophns") != -1 ) ) { new info [ 7 ],szName [ 33 ], data [ 2 ] data [ 0 ] = id
parse ( said,info,6,szName,31 ) if ( equali ( info,"/tophns" ) ) { if ( equal ( szName [ 0 ],"" ) ) data [ 1 ] = id
Vault = nvault_open ( VAULTNAME ) if ( Vault == INVALID_HANDLE ) { server_print( "Error opening nVault file: %s",VAULTNAME ) } else { new steamid [ 32 ],playerinfo [ 4 ] [ 32 ] new key [ 32 ],val [ 511 ],TimeStamp
get_user_authid ( id,steamid,31 ) format( key,32,"%s",steamid )
if( nvault_lookup ( Vault, key, val, 510, TimeStamp ) ) { parse ( val, playerinfo [ 0 ], 31, playerinfo [ 1 ], 31, playerinfo [ 2 ], 31, playerinfo [ 3 ], 31 ) new update [ 511 ] rounds += str_to_num ( playerinfo [ 1 ] ) connects += str_to_num ( playerinfo [ 2 ] ) time += str_to_num ( playerinfo [ 3 ] ) format( update,510,"^"%s^" %i %i %i",playerinfo [ 0 ], rounds, connects, time ) nvault_set ( Vault, key, update ) } else { new update [ 511 ], szName[ 32 ] get_user_name ( id, szName, 31 ) format ( update,510,"^"%s^" %i %i %i",szName,0,1,0 ) nvault_set ( Vault, key, update )
new g_Nlen = menu_create ( "\rTOP HNS:","tophnssettings" )
menu_additem ( g_Nlen,"\w#NICK | TIMP | PUNCTE","1",0 ) menu_additem ( g_Nlen,"\w%s | %s | %s,"2",0,szName,update,PlayerPoints ) menu_additem ( g_Nlen,"\w%s | %s | %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 | %s | %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 | %s | %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 | %s | %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 | %s | %s,"11",0,szName,update,PlayerPoints )
menu_setprop ( g_Nlen,MPROP_EXIT,MEXIT_ALL ) menu_display ( id,menu,0 ) } nvault_close ( Vault ) } } public tophnssettings ( id,g_Nlen,item ) { if ( item == MENU_EXIT ) { menu_destroy ( g_Nlen ) return 1 } new data [ 6 ],iName [ 64 ] new access, callback
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 [ 0 ] new playerid = userids [ 1 ] Vault = nvault_open ( VAULTNAME ) if ( Vault == INVALID_HANDLE ) { server_print("Error opening nVault file: %s",VAULTNAME) } else { new steamid [ 32 ], playerinfo [ 4 ][ 64 ] new key [ 32 ], val [ 511 ], TimeStamp get_user_authid ( playerid,steamid,31 ) format( key,32,"%s",steamid ) if ( nvault_lookup ( Vault, key, val, 510, TimeStamp ) ) { parse ( val, playerinfo [ 0 ], 63, playerinfo [ 1 ], 63, playerinfo [ 2 ], 63, playerinfo [ 3 ], 63 )
new Float:gametime = get_gametime ( ) new onlinetime = floatround ( gametime - g_onlinetime [ playerid ] ) new ptime = str_to_num(playerinfo [ 3 ] ) + 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 ( totaltime, 63, "%s%s%s%s", ( days >= 1 ? sday:"" ), ( hours >= 1 ? shr:"" ), smin, ( hours == 0 ? ssec:"" ) ) nvault_close ( Vault ) updateUser ( playerid, 0, 0, onlinetime ) g_onlinetime [ playerid ] = gametime } } return PLUGIN_HANDLED } public death_event ( ) { new killer,victim; killer = read_data ( 1 ) victim = read_data ( 2 )
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 ( gVault, gAuthId[ id ], szData ) }
Errors:
PHP Code:
/home/groups/amxmodx/tmp3/phpd0xVAH.sma(12) : error 088: number of arguments does not match definition /home/groups/amxmodx/tmp3/phpd0xVAH.sma(13) : error 088: number of arguments does not match definition /home/groups/amxmodx/tmp3/phpd0xVAH.sma(25) : error 017: undefined symbol "ps_load_points" /home/groups/amxmodx/tmp3/phpd0xVAH.sma(29) : error 017: undefined symbol "ps_save_points" /home/groups/amxmodx/tmp3/phpd0xVAH.sma(76) : warning 217: loose indentation /home/groups/amxmodx/tmp3/phpd0xVAH.sma(109) : error 001: expected token: ",", but found "-integer value-" /home/groups/amxmodx/tmp3/phpd0xVAH.sma(109) : error 037: invalid string (possibly non-terminated string) /home/groups/amxmodx/tmp3/phpd0xVAH.sma(109 -- 110) : warning 215: expression has no effect /home/groups/amxmodx/tmp3/phpd0xVAH.sma(110) : error 001: expected token: ",", but found "-integer value-" /home/groups/amxmodx/tmp3/phpd0xVAH.sma(110) : fatal error 107: too many error messages on one line
Thanks.
Credits goes to: TitANious (for 'Ranks') & Alka (played time).
|
|