Raised This Month: $ Target: $400
 0% 

how to refresh stats after adding frags ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
orglee
Member
Join Date: Dec 2005
Old 12-08-2007 , 18:49   how to refresh stats after adding frags ?
Reply With Quote #1

Hello.
I have one line of code which gives a player reward for picking up a flag:
Code:
set_user_frags(id, get_user_frags(id) + get_pcvar_num(pickupreward_frags))
But stats does not refreshes automatically. Only when player kills someone.
So how to refresh stats ?
orglee is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-08-2007 , 20:14   Re: how to refresh stats after adding frags ?
Reply With Quote #2

Using ScoreInfo event : http://wiki.alliedmods.net/Half-Life...ents#ScoreInfo
__________________
Arkshine is offline
orglee
Member
Join Date: Dec 2005
Old 12-08-2007 , 22:09   Re: how to refresh stats after adding frags ?
Reply With Quote #3

Well I've searched all forums and I cannot find any part of code which will tell me how to implement this. I really don't know how can I refresh stats or use that event. I found some code examples how to check does user presses +showscores but I don't think it can help.
http://forums.alliedmods.net/showpost.php?p=455980
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {       register_plugin("Block ShowScore", "1.0", "P34nut")   register_forward(FM_PlayerPreThink, "fwPlayerPreThink") } public fwPlayerPreThink(id) {       static iButton       iButton = pev(id, pev_button)           if (iButton & IN_SCORE)           set_pev(id, pev_button, iButton & ~IN_SCORE) }
http://forums.alliedmods.net/showpos...1&postcount=10
Code:
public plugin_init() {   register_message(get_user_msgid("ScoreInfo"), "hook_ScoreInfo" ); } public hook_ScoreInfo() {     return PLUGIN_HANDLED; }
orglee is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-08-2007 , 23:08   Re: how to refresh stats after adding frags ?
Reply With Quote #4

Something like :


Code:
new g_msgScoreInfo; public plugin_init() {     g_msgScoreInfo = get_user_msgid( "ScoreInfo" ); } UpdateScoreboard( id ) {     // Update killers scorboard with new info     message_begin( MSG_ALL, g_msgScoreInfo )     write_byte( id )     write_short( get_user_frags( id ) )     write_short( get_user_deaths( id ) )     write_short( 0 )     write_short( get_user_team( id ) )     message_end() }
__________________

Last edited by Arkshine; 12-08-2007 at 23:32.
Arkshine is offline
orglee
Member
Join Date: Dec 2005
Old 12-08-2007 , 23:22   Re: how to refresh stats after adding frags ?
Reply With Quote #5

Does it updates all players scoreboard ?
orglee is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-08-2007 , 23:29   Re: how to refresh stats after adding frags ?
Reply With Quote #6

message_begin( MSG_ALL, g_msgScoreInfo ) . So yes, it does.
__________________
Arkshine is offline
orglee
Member
Join Date: Dec 2005
Old 12-08-2007 , 23:44   Re: how to refresh stats after adding frags ?
Reply With Quote #7

Thank you it works for me perfectly
orglee is offline
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 11:07.


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