Page 1 of 1

Cerere Plugin pastrare scoruri in TAB

Posted: 08 Nov 2019, 23:27
by robbencsgo
Am un plugin de mix si as vrea ca atunci cand schimba echipele si da sv_restart 1 sa se pastreze scoruile echipelor in TAB, nu si cele ale jucatorilor.

Re: Cerere Plugin pastrare scoruri in TAB

Posted: 09 Nov 2019, 01:42
by levin
o să mai modific codu dacă nu merge

Code: Select all

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Set Team Scores"
#define VERSION "0.01"
#define AUTHOR "TuTorial"

enum
{
	TEAM_NONE = 0, // This is NULL Team and always = 0
	TEAM_RED,        // This is Red Team = 1
	TEAM_BLUE,       // This is Blue Team = 2
	TEAM_SPEC       // This is Spectator = 3
}

new const g_szHLTeams[][] =//nu creca vrei asta
{
	"",                // Also like the first one this is NULL but this is a Sting
	"T TEAM",     // my red team name
	"CT TEAM",        // my blue team name
	"SPECTATOR"  //this is spectator as you know .
}

new gMsg_TeamScore
new g_iScore[3]

//new TerrScore, CTScore,bool:rr	//ROAD2FORCE!
new TSS,CTSS

public plugin_init() {
   register_plugin(PLUGIN, VERSION, AUTHOR)
   gMsg_TeamScore = get_user_msgid("TeamScore")
   register_message(gMsg_TeamScore, "msg_teamScore")

   //register_event("HLTV", "new_round", "a", "1=0", "2=0")
   register_event("TeamScore", "terr_score", "a", "1=TERRORIST")
   register_event("TeamScore", "ct_score", "a", "1=CT")
   register_event("TextMsg", "restart_round", "a", "2=#Game_will_restart_in", "2&#Game_C")
}

//public new_round()	rr=false
public restart_round()
{
    g_iScore[TEAM_RED]=TSS
    g_iScore[TEAM_BLUE]=CTSS
    //rr=true
    for(new id=1;id<=get_maxplayers();id++)	if(!(is_user_bot(id)||is_user_hltv(id))&&is_user_connected(id))	Function(id)
}
public terr_score()	TSS = read_data(2)
public ct_score()	CTSS = read_data(2)

public Function(id)
{
   new iTeam = get_user_team(id)
   switch(iTeam)
   {
      case 1: iTeam = TEAM_RED
      case 2: iTeam = TEAM_BLUE
   }
   emessage_begin(MSG_BROADCAST, gMsg_TeamScore) // Send message 
   ewrite_string(g_szHLTeams[id]) //Check string names for teams
   ewrite_short(g_iScore[iTeam]) // Rewrite Scores 	++?
   ewrite_short(0)                        //This is Deaths i think we dont need to set this
   emessage_end()
}

public msg_teamScore()
{
   static szTeam[32]
   get_msg_arg_string(1, szTeam, 1)
   switch(szTeam[0])
   {
      case 1: set_msg_arg_int(2, ARG_SHORT, g_iScore[TEAM_RED]) //This is msg for Red team will send this scores  that you added with your Function
      case 2: set_msg_arg_int(2, ARG_SHORT, g_iScore[TEAM_BLUE]) // The same 
   }
}