Raised This Month: $12 Target: $400
 3% 

Team scores


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-16-2007 , 17:44   Team scores
Reply With Quote #1

I have made this code =>>

PHP Code:
#include <amxmodx>
#include <cshack>
#include <cstrike>
 
#define PLUGIN[] "Team Scores"
#define VERSION[] "1.0"
#define AUTHOR[] "Alka"
 
public plugin_init()
{
 
register_plugin(PLUGIN[], VERSION[], AUTHOR[]);
 
set_task(0.1,"scores",0,"",0,"b");
 
register_event("ResetHUD","scores","b")
}
 
public 
scores(id)
{
 new 
csscore
 
new tscore
 csscore 
cs_get_team_score(2); 
 
tscore cs_get_team_score(1); 
 
 if(
cs_get_user_team(id) == CS_TEAM_CT)
 {
  
set_hudmessage(002550.530.1106.03700.0); 
  
show_hudmessage(id"CT SCORE: %s"csscore);
 }
 
 else if(
cs_get_user_team(id) == CS_TEAM_T)
 {
  
set_hudmessage(255000.530.1106.03700.0); 
  
show_hudmessage(id"T SCORE: %d"tscore);
 }

But doesn't work!Can anyone help me?! Thanks in advanced...
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 03-16-2007 at 18:35.
Alka is offline
Des12
Senior Member
Join Date: Jan 2005
Old 03-16-2007 , 18:42   Re: Team scores
Reply With Quote #2

You need to loop through all the players individually.
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-16-2007 , 18:47   Re: Team scores
Reply With Quote #3

hmmm...but say
Code:
L 03/16/2007 - 23:39:13: [CSTRIKE] Player out of range (0)
L 03/16/2007 - 23:39:13: [AMXX] Run time error 10 (plugin "team_scores.amxx") (native "cs_get_user_team")
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 03-16-2007 , 19:12   Re: Team scores
Reply With Quote #4

PHP Code:
public scores()
{
 new 
csscore
 
new tscore
 csscore 
cs_get_team_score(2); 
 
tscore cs_get_team_score(1); 
 for(new 
i=1;i<=get_maxplayers();i++){ 
     if(!
is_user_connected(i)
       continue;
     if(
cs_get_user_team(i) == CS_TEAM_CT)
     {
      
set_hudmessage(002550.530.1106.03700.0); 
      
show_hudmessage(i"CT SCORE: %s"csscore);
     }
     
     else if(
cs_get_user_team(i) == CS_TEAM_T)
     {
      
set_hudmessage(255000.530.1106.03700.0); 
      
show_hudmessage(i"T SCORE: %d"tscore);
     }
  }

__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-16-2007 , 20:55   Re: Team scores
Reply With Quote #5

Don't use getmaxplayers.

Here, a little better I think :

Code:
#include <amxmodx> #include <cshack> #include <cstrike>   #define PLUGIN  "Team Scores" #define VERSION "1.0" #define AUTHOR  "Alka"   new const TEAM_SCORE[2][0]= { "T SCORE", "CT SCORE" };   public plugin_init() {     register_plugin( PLUGIN, VERSION, AUTHOR );     register_logevent( "event_game_commencing", 2, "1=Game_Commencing" ); } public event_game_commencing( )  set_task( 2.0, "scores", 0, "", 0, "b" );   public scores() {     static scoreCT, scoreT;     scoreT  = cs_get_team_score( _:CS_TEAM_T );     scoreCT = cs_get_team_score( _:CS_TEAM_CT );       static iPlayers[32], iPlayer, pNum;     static CsTeams:userTeam, r, b;         get_players( iPlayers, pNum, "a" );         for( new i = 0; i <= pNum; i++ )     {         iPlayer = iPlayers[i];                 if( !is_user_connected( iPlayer ) )             continue;                 userTeam = cs_get_user_team( iPlayer );                 switch( userTeam )         {             case CS_TEAM_T  :             {                 r = 255;                 b = 0;             }             case CS_TEAM_CT :             {                 r = 0;                 b = 255;             }         }                 set_hudmessage( r, 0, b, 0.53, 0.11, 0, 6.0, 3700.0 );         show_hudmessage( iPlayer, "%s: %d", TEAM_SCORE[_:userTeam - 1] , userTeam == CS_TEAM_T ? scoreT : scoreCT );        } }
__________________

Last edited by Arkshine; 03-16-2007 at 21:29.
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-17-2007 , 04:54   Re: Team scores
Reply With Quote #6

Thanks arkshine....Is working very well. +Karma
__________________
Still...lovin' . Connor noob! Hello
Alka 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 16:26.


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