Raised This Month: $ Target: $400
 0% 

Updating scoreboard help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Locks
Senior Member
Join Date: Sep 2005
Old 01-15-2007 , 21:41   Updating scoreboard help
Reply With Quote #1

I'm having some trouble on updating the scoreboard with my plugin.

The problem I'm having is that the scoreboard won't update itself after I rescued the hostages.

Here's the code on what I have so far:
Code:
#include <amxmodx> //#include <cstrike> #include <fun> static const PLUGIN_NAME[] = "Hostage Score Management" static const PLUGIN_VERSION[] = "1.1" static const PLUGIN_AUTHOR[] = "Locks" new pcvarfragreward new pcvarfragpenalty public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)     pcvarfragreward = register_cvar("hostage_fragreward", "1")     pcvarfragpenalty = register_cvar("hostage_fragpenalty", "1")     register_event("TextMsg", "hostage_killed", "b", "2&#Killed_Hostage")     register_logevent("rescued_hostage", 3, "2=Rescued_A_Hostage") } // VEN's stock from CS Bomb Scripting [FAQ/Tutorial] // <a href="http://forums.alliedmods.net/showthread.php?t=40164" target="_blank" rel="nofollow noopener">http://forums.alliedmods.net/showthread.php?t=40164</a> stock get_loguser_index() {     new loguser[80], name[32]     read_logargv(0, loguser, 79)     parse_loguser(loguser, name, 31)       return get_user_index(name) } public rescued_hostage() {     new id = get_loguser_index()     new frags = get_user_frags(id)     new reward = get_pcvar_num(pcvarfragreward)     if ( !is_user_alive(id) /*|| get_pcvar_num(pcvarfragreward) == 0*/ )         return PLUGIN_HANDLED     set_user_frags(id, frags + reward)     new score_info = get_user_msgid("ScoreInfo")     message_begin(MSG_ALL, score_info)     write_byte(id)  // Index     write_short(get_user_frags(id)) // Frags     write_short(get_user_deaths(id))    // Death     write_short(0)  // ...     write_short(1)  // TEAM     message_end()     return PLUGIN_HANDLED } public hostage_killed(id) {     new frags = get_user_frags(id)     new penalty = get_pcvar_num(pcvarfragpenalty)     if ( !is_user_alive(id) || get_pcvar_num(pcvarfragpenalty) == 0 )         return PLUGIN_HANDLED     set_user_frags(id, frags - penalty)     new score_info = get_user_msgid("ScoreMsg")     message_begin(MSG_ALL, score_info)     write_byte(id)     write_short(get_user_frags(id))     write_short(get_user_deaths(id))     write_short(0)     write_short(1)     message_end()     return PLUGIN_HANDLED }
Locks is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-16-2007 , 05:11   Re: Updating scoreboard help
Reply With Quote #2

Aren't you parsing the name of the user, and returning it?
If so, you can't use the name to get frags, or adding score.
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-16-2007 , 06:40   Re: Updating scoreboard help
Reply With Quote #3

Quote:
new score_info = get_user_msgid(...)
Better cache the value into a global variable.

Quote:
"ScoreMsg"
Interesting...

Quote:
get_user_deaths(id)
You have to look into cstrike.inc

Quote:
write_short(1) // TEAM
What about CTs?
VEN is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-16-2007 , 09:00   Re: Updating scoreboard help
Reply With Quote #4

An example of how I do it in ESF:

Code:
public UpdateScore(id){ new playerClass = entity_get_int(id, EV_INT_playerclass) new team[32] get_user_team(id,team,31) message_begin(MSG_ALL,g_iMsgScoreInfo) write_byte(id) write_short(get_user_frags(id)) write_short(get_user_deaths(id)) write_short(0) write_short(playerClass) //This shortmessage is about the color of the player's line(on the scoreboard), good = blue, evil = red if( containi( team, "Good" ) != -1 ) { write_short(1) }else if( containi( team, "Evil" ) != -1 ) { write_short(2) } message_end() }
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat 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 22:24.


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