AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [HELP] Score (https://forums.alliedmods.net/showthread.php?t=183796)

extream87 04-26-2012 18:57

[HELP] Score
 
Code:
#include <amxmodx> #include <amxmisc> #include <dhudmessage> #define PLUGIN    "Team Score" #define VERSION    "1.0" #define AUTHOR    "BaRSiK" new ct_score, terrorist_score; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_event("TeamScore", "team_score", "a");     set_task(1.0,"score_round",_,_,_,"b") } public team_score() {     new team[32];     read_data(1,team,31);     if (equal(team,"CT"))     {         ct_score = read_data(2);     }     else if (equal(team,"TERRORIST"))     {         terrorist_score = read_data(2);     } }       public score_round() {     set_dhudmessage(0, 70, 200, -1.0, 0.0, 0, 0.5, 2.0, 0.08, 2.0, true);     show_dhudmessage(0,"Cops:%d|                       ", ct_score);           set_dhudmessage(200, 0, 0, -1.0, 0.0, 0, 0.5, 2.0, 0.08, 2.0, true);     show_dhudmessage(0,"                       |%d:Terrorists", terrorist_score); }
It is possible to maintain the results of rounds after sv_restart 1?

For example:
Code:
if( ++g_iRounds >= 15
save score

Exolent[jNr] 04-27-2012 00:17

Re: [HELP] Score
 
Code:
public team_score() {     static old_score = 0;     new score = read_data(2) - old_score;         if(score > 0)     {         if(team[0] == 'T')             terrorist_score += score;         else             ct_score += score;     }         old_score = score; }

nss 04-27-2012 06:35

Re: [HELP] Score
 
may i ask for adding this to this plugin : keep all player 's score/death when using "sv_restartround 1" ?
:D

extream87 04-27-2012 08:13

Re: [HELP] Score
 
Code:
 /* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <dhudmessage> #define ADMIN_LEVEL ADMIN_IMMUNITY //MUDA SE QUISERES enum Data {     TAG_CT[ 10 ] ,     TAG_T[ 10 ],     nCT,     nT,     nR, } new g_Teamscore[Data]; public plugin_init() {     register_plugin("TeamScore", "1.0", "extream87")         copy(g_Teamscore[TAG_T], 9, "T")     copy(g_Teamscore[TAG_CT], 9, "CT")     register_clcmd( "say", "CmdSay" );     register_clcmd( "say_team ", "CmdSay" );         register_event("SendAudio", "nice_team_score_ct", "a", "2&%!MRAD_ctwin")     register_event("SendAudio", "nice_team_score_t", "a", "2&%!MRAD_terwin")         register_logevent("nice_team_score_round", 2, "1=Round_End")     register_logevent("nice_team_score_reset", 2, "1&Restart_Round_", "1=Game_Commencing")         register_event("HLTV", "nice_team_score_msg", "a", "1=0", "2=0") } public CmdSay(id) {     if (get_user_flags(id) & ADMIN_LEVEL)     {         new szArgs[30], szAgr1[10], szAgr2[10];         read_args( szArgs, charsmax( szArgs ) );         remove_quotes( szArgs );         parse( szArgs, szAgr1, charsmax( szAgr1 ), szAgr2,  charsmax( szAgr2 ) )         if (equal(szAgr1, ".teamct"))             g_Teamscore[TAG_CT] = szAgr2         else if(equal(szAgr1, ".teamtt"))             g_Teamscore[TAG_T] = szAgr2     } } public nice_team_score_msg() {     set_dhudmessage(255, 0, 0, -1.0, 0.03, 0, 0.5, 2.0, 0.08, 3.0, true)     show_dhudmessage(0,"   %s:%d                           ", g_Teamscore[TAG_T], g_Teamscore[nT], g_Teamscore[nR]);         set_dhudmessage(0, 125, 255, -1.0, 0.03, 0, 0.5, 2.0, 0.08, 3.0, true)     show_dhudmessage(0,"                          %d:%s ", g_Teamscore[nCT], g_Teamscore[TAG_CT], g_Teamscore[nR]); } public nice_team_score_ct() {     g_Teamscore[nCT]++ } public nice_team_score_t() {     g_Teamscore[nT]++ } public nice_team_score_round() {     g_Teamscore[nR]++ } public nice_team_score_reset() {     g_Teamscore[nCT] = 0         g_Teamscore[nT] = 0         g_Teamscore[nR] = 0 }
Exolent[jNr] can you edit this with: Maintain the results of rounds after sv_restart 1?

Exolent[jNr] 04-27-2012 11:17

Re: [HELP] Score
 
Remove this:
Code:
register_logevent("nice_team_score_reset", 2, "1&Restart_Round_", "1=Game_Commencing")

Xalus 04-27-2012 11:20

Re: [HELP] Score
 
Quote:

Originally Posted by Exolent[jNr] (Post 1697185)
Code:
public team_score() {     static old_score = 0;     new score = read_data(2) - old_score;         if(score > 0)     {         if(team[0] == 'T')             terrorist_score += score;         else             ct_score += score;     } }

You never update old_score ?

Exolent[jNr] 04-27-2012 11:21

Re: [HELP] Score
 
Quote:

Originally Posted by Xalus (Post 1697461)
You never update old_score ?

Yep, forgot about it.

extream87 04-27-2012 12:32

Re: [HELP] Score
 
Exolent[jNr] If I remove it to give live and one player is afk the round will continue counting from 1 rather than 0
Code:
register_logevent("nice_team_score_reset", 2, "1&Restart_Round_", "1=Game_Commencing")

Exolent[jNr] 04-27-2012 17:26

Re: [HELP] Score
 
Then change
Code:
register_logevent("nice_team_score_reset", 2, "1&Restart_Round_", "1=Game_Commencing")
to
Code:
register_logevent("nice_team_score_reset", 2, "1=Game_Commencing")

extream87 04-27-2012 18:32

Re: [HELP] Score
 
That is equal if i do .rr the score no reset.

Example: 1st half the result is 8-7 an in the 2nd round if you are already 10-7 type sv_restart 1 the result back to 8-7


All times are GMT -4. The time now is 10:58.

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