Raised This Month: $ Target: $400
 0% 

Count rounds in a match


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ramiro000
New Member
Join Date: Nov 2009
Old 11-26-2009 , 20:34   Count rounds in a match
Reply With Quote #1

Hello, i am a Beginner Developer, and i am making a match plugin for my server.
I made the Match initialization and the .r, but i cant find a command to get rounds, and who won that round.
I want the plugin to say, for example:
"CT have won the round. CT Leads 1-0"

Thanks in advance.
ramiro000 is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 11-26-2009 , 20:46   Re: Count rounds in a match
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>

new ctscore 
new tscore 0

public plugin_init()
{
    
register_event("TeamScore""team_score""a")
}

public 
team_score()

    new 
team[32]
    
read_data(1,team,32)

    if (
equal(team,"CT"))
    { 
        
ctscore read_data(2)
    }
    else if (
equal(team,"TERRORIST"))
    {
        
tscore read_data(2)
    }
    return 
PLUGIN_CONTINUE

with this code u can count team scrores. u need now a function
to check wich team wins the match based on the scores and Match Rounds like MR 15 or MR 12 u have to check how many rounds are played and who has the highest team score, then u got the winner ;)
platzpatrone is offline
ramiro000
New Member
Join Date: Nov 2009
Old 11-27-2009 , 12:31   Re: Count rounds in a match
Reply With Quote #3

Thanks for your help, i did all the code but it throws me several errors.
I´m very noob, but i tried everithing (since i have intermediate C knowledges and Pawn is very similar).
Here are the errors:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/groups/amxmodx/tmp3/text6U83Fk.sma(30) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(34) : warning 204: symbol is assigned a value that is never used: "players"
/groups/amxmodx/tmp3/text6U83Fk.sma(34) : warning 209: function "check_players" should return a value
/groups/amxmodx/tmp3/text6U83Fk.sma(38) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(44) : warning 225: unreachable code
/groups/amxmodx/tmp3/text6U83Fk.sma(47) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/text6U83Fk.sma(49) : warning 209: function "start_match" should return a value
/groups/amxmodx/tmp3/text6U83Fk.sma(79) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(83) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/text6U83Fk.sma(83) : error 017: undefined symbol "first_half"
/groups/amxmodx/tmp3/text6U83Fk.sma(86) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(94) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/text6U83Fk.sma(94) : error 017: undefined symbol "second_half"
/groups/amxmodx/tmp3/text6U83Fk.sma(97) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(100) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(103) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(103) : warning 211: possibly unintended assignment
/groups/amxmodx/tmp3/text6U83Fk.sma(103) : error 022: must be lvalue (non-constant)
/groups/amxmodx/tmp3/text6U83Fk.sma(103) : warning 215: expression has no effect
/groups/amxmodx/tmp3/text6U83Fk.sma(103) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/text6U83Fk.sma(107) : warning 225: unreachable code
/groups/amxmodx/tmp3/text6U83Fk.sma(107) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/text6U83Fk.sma(107) : error 017: undefined symbol "end_match"
/groups/amxmodx/tmp3/text6U83Fk.sma(113) : error 001: expected token: "}", but found "-end of file-"

10 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/text6U83Fk.amx (compile failed).
and here is the code:

Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Match Mod"
#define VERSION "0.1a RC 1"
#define AUTHOR "Ramiro Escudero"
new ready_players = 0
new ctscore = 0
new tscore = 0
new round_counter = 0
new trigger = 0

public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_concmd("ma_matchmode", "check_players", ADMIN_ALL, "Usage: ma_matchmode")
 register_event("say .r", "ready", "a")
 register_event("TeamScore", "team_score", "a")
 register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
 register_logevent("round_end", 2, "0=World triggered", "1=Round_End")
}
public check_players() {
 new players = get_playersnum()
 
 if(players = 10) {
  return PLUGIN_CONTINUE
 }
 
}
public start_match() {
 server_cmd("say The match will start when all players put .r in say")
 if(ready_players = 10) {
  server_cmd("say All players are ready, executing match.cfg")
  server_cmd("exec match.cfg")
  server_cmd("say Match.cfg executed, the first half will start")
  server_cmd("say The match is to 30, with two half of 15")
  return PLUGIN_CONTINUE
  trigger = 1
 }
 else {
  public start_match()
  }
}
public ready() {
 ready_players++
}
public roundstart() {
 round_counter++
}
public team_score()
{ 
 new team[32]
 read_data(1,team,32)
 
 if (equal(team,"CT"))
 { 
  ctscore = read_data(2)
 }
 else if (equal(team,"TERRORIST"))
 {
  tscore = read_data(2)
 }
 return PLUGIN_CONTINUE
}  
 

public  round_end() 
{
 while(trigger = 1 && round_counter < 31) {
  server_cmd("say Team 1: %d Team 2: %d", ctscore, tscore)
 }
 
 public first_half() {
  server_cmd("exec lo3.cfg")
  server_cmd("say First half started GL HF, Plugin by Fus!l3r")
  if(round_counter = 16) {
   server_cmd("exec swap.cfg")
   server_cmd("say First half ended")
   server_cmd("say Scores so far: Team 1: %d Team 2: %d", ctscore, tscore)
   server_cmd("say Starting Second Half")
   return PLUGIN_CONTINUE
  }
 }
 public second_half() {
  server_cmd("exec lo3.cfg")
  server_cmd("say Second half started GL HF, Plugin by Fus!l3r")
  if(ctscore = 16) {
   return PLUGIN_CONTINUE
  }
  else if(tscore = 16) {
   return PLUGIN_CONTINUE
  }
  else if(ctscore = 15 && tscore = 15;) {
   return PLUGIN_CONTINUE
  }
 }
 public end_match() {
  server_cmd("say Match ended! Final Score: Team 1: %d Team 2: %d", ctscore, tscore)
  server_cmd("exec normal.cfg")
  server_cmd("say All settings Back to normal!. Plugin by Fus!l3r")
  trigger = 0
  return PLUGIN_HANDLED
 }
I accept suggestions and corrections. Thanks in advance and forgive me for the bad english, since i´ts not my mother language.
ramiro000 is offline
Hx7r
Member
Join Date: Mar 2009
Old 11-27-2009 , 12:41   Re: Count rounds in a match
Reply With Quote #4

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Match Mod" #define VERSION "0.1a RC 1" #define AUTHOR "Ramiro Escudero" new ready_players = 0 new ctscore = 0 new tscore = 0 new round_counter = 0 new trigger = 0 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("ma_matchmode", "check_players", ADMIN_ALL, "Usage: ma_matchmode")     register_event("say .r", "ready", "a")     register_event("TeamScore", "team_score", "a")     register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")     register_logevent("round_end", 2, "0=World triggered", "1=Round_End") } public check_players() {     new players = get_playersnum()         if(players == 10) {         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE;     } public start_match() {     server_cmd("say The match will start when all players put .r in say")     if(ready_players == 10) {         server_cmd("say All players are ready, executing match.cfg")         server_cmd("exec match.cfg")         server_cmd("say Match.cfg executed, the first half will start")         server_cmd("say The match is to 30, with two half of 15")                 trigger = 1         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE; } public ready() {     ready_players++ } public roundstart() {     round_counter++ } public team_score() {     new team[32]     read_data(1,team,32)         if (equal(team,"CT"))     {         ctscore = read_data(2)     }     else if (equal(team,"TERRORIST"))     {         tscore = read_data(2)     }     return PLUGIN_CONTINUE }   public  round_end() {     while(trigger == 1 && round_counter < 31) {         server_cmd("say Team 1: %d Team 2: %d", ctscore, tscore)     }     } public first_half() {     server_cmd("exec lo3.cfg")     server_cmd("say First half started GL HF, Plugin by Fus!l3r")     if(round_counter == 16) {         server_cmd("exec swap.cfg")         server_cmd("say First half ended")         server_cmd("say Scores so far: Team 1: %d Team 2: %d", ctscore, tscore)         server_cmd("say Starting Second Half")         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE; } public second_half() {     server_cmd("exec lo3.cfg")     server_cmd("say Second half started GL HF, Plugin by Fus!l3r")     if(ctscore == 16) {         return PLUGIN_CONTINUE     }     else if(tscore == 16) {         return PLUGIN_CONTINUE     }     else if(ctscore == 15 && tscore == 15) {         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE; } public end_match() {     server_cmd("say Match ended! Final Score: Team 1: %d Team 2: %d", ctscore, tscore)     server_cmd("exec normal.cfg")     server_cmd("say All settings Back to normal!. Plugin by Fus!l3r")     trigger = 0     return PLUGIN_HANDLED }
Hx7r is offline
ramiro000
New Member
Join Date: Nov 2009
Old 11-27-2009 , 12:48   Re: Count rounds in a match
Reply With Quote #5

Thanks, you were very helpful, now it´s solved.
ramiro000 is offline
Reply


Thread Tools
Display Modes

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 13:41.


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