Pinfo change rounds with steamid
I am trying to make Pinfo more of an admin query tool so my admins can get a little more info from a user (without having to go into console, then go to hlsw, etcetera)
I basically want to change the rounds section with the players steamID I dont know where or how to begin on doing this..
can I get some help??
(original)
PHP Code:
/* * Comments: * Displays player information. For Example... * First Nick is the very first nick they had when their profile was created. * Time Played is total time person has played on your server. Not just their current session. * [ FIRST NICK: OneEyed ][ CONNECTS: 152 ][ ROUNDS: 25 ][ TIME PLAYED: 2 Days 3 Hrs 52 Mins ] * * Note: * Plugin is self-sufficient, just compile and add to plugins.ini / plugin folder and your set. * All player data will be saved into pinfo.vault @ amxmodx/data/vault folder. * * Chat Command: * !info name - Typed in chat. If no name specified, returns your own info. * * Version : 2.0 * Requires: AMXX 1.70+ and NVAULT module * Gametype: CS/NS/DOD * * Author: OneEyed * Date: 01-23-2006 * Email: [email protected] * IRC: #modns (gamesurge.net) * * Tested : * WIN32 Tested and Approved! LINUX untested. * * Credits: * voogru - He used it on his server (I sorta replicated it) * * Change Log: * v2.0 - Updated plugin to use nVault instead of *.ini file. * v1.1 - Fixed to update played time at round end/map change, no more looped task. * */
//--------------------------------------------------------------------------------------------- //-------------------DO NOT EDIT BELOW--------------------------------------------------------- #include <amxmodx> #include <amxmisc> #include <nvault>
new Float:g_onlinetime[33] new maxplayers
new Vault static const VAULTNAME[] = "pinfo"
static const TITLE[] = "PInfo" static const VERSION[] = "2.0" static const AUTHOR[] = "OneEyed" //--------------------------------------------------------------------------------------------------- public plugin_init() { register_plugin(TITLE, VERSION, AUTHOR) register_cvar(TITLE,VERSION,FCVAR_SERVER) //plugin displays as cvar for HLSW or whatever maxplayers = get_maxplayers() register_clcmd("say","handle_say") new modname[32] get_modname(modname,31) if(equali("cstrike",modname)) register_event("SendAudio","EndofRound","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw") else if(equali("ns",modname)) register_event("GameStatus", "EndofRound", "ab", "1=2") else if(equali("dod",modname)) register_event("RoundState","EndofRound","a","1=3","1=4") } //--------------------------------------------------------------------------------------------------- public plugin_end() { //update user on map change but not 2 times new Float:gametime = get_gametime() for(new id=1;id<=maxplayers;id++) if( is_user_connected(id) ) updateUser(id, 0, 0, floatround(gametime - g_onlinetime[id])) } //--------------------------------------------------------------------------------------------------- public EndofRound() { new Float:gametime = get_gametime() for(new id=1;id<=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_connected(id) && !is_user_bot(id)) { updateUser(id, 0, 1, 0) g_onlinetime[id] = get_gametime() - 3.0 } } //--------------------------------------------------------------------------------------------------- public client_disconnect(id) { if(!is_user_bot(id)) updateUser(id, 0, 0, floatround(get_gametime()-g_onlinetime[id])) g_onlinetime[id] = 0.0 } //--------------------------------------------------------------------------------------------------- public handle_say(id) { new said[192] read_args(said,191) remove_quotes(said) if( (containi(said, "!info") != -1) ) { new info[7] new name[34] new data[2] data[0] = id parse(said, info, 6, name, 33) if(equali(info, "!info")) if(equal(name[0],"")) { data[1] = id set_task(0.1, "printUserInfo", id, data, 2) } else { data[1] = cmd_target(id,name,2) // Don't block access... if(data[1]) set_task(0.1, "printUserInfo", id, data, 2) else client_print(id,print_chat,"[PInfo] - There is no player with that name.") } } return PLUGIN_CONTINUE } //--------------------------------------------------------------------------------------------------- updateUser(id, rounds, connects, time) { Vault = nvault_open( VAULTNAME ) if(Vault == INVALID_HANDLE) server_print("Error opening nVault file: %s",VAULTNAME) else { new steamid[32], playerinfo[4][32] // "FIRSTNICK" "ROUNDS" "CONNECTIONS" "TOTALTIME" 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], name[32] get_user_name(id, name, 31) format(update,510,"^"%s^" %i %i %i",name,0,1,0) nvault_set(Vault, key, update) } nvault_close(Vault) } } //--------------------------------------------------------------------------------------------------- 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] // "FIRSTNICK" "ROUNDS" "CONNECTIONS" "TOTALTIME" new key[32], val[511], TimeStamp, text[512] 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:"")) format(text,511,"[ FIRST NICK: %s ][ CONNECTS: %s ][ ROUNDS: %s ][ TIME PLAYED: %s ]",playerinfo[0],playerinfo[2],playerinfo[1],totaltime) client_print(id,print_chat,"%s",text) nvault_close(Vault) updateUser(playerid, 0, 0, onlinetime) g_onlinetime[playerid] = gametime } } return PLUGIN_HANDLED }
I am configuring this for team fortress classic, which doesnt use rounds at all, so that can be completely removed, the only problem is I dont even know how to simply make a plugin that will make the server say hello
:( can someone help me please?
|