Problém s teamcolor

Technická podpora k herním serverům Counter-Strike 1.6
Message
Autor
Branik28
Příspěvky: 32
Registrován: 27 úno 2011, 12:02
Reputation: 0

Problém s teamcolor

#1 Příspěvekod Branik28 » 03 kvě 2011, 17:35

Dobrý, mám menší problém s jedným pluginom.

Kód: Vybrat vše

ColorChat(0, GREEN, "%s^x01 s IP ^x03%s^x01 Sa odpojil (^x03%s^x01)", user, ip, Country )

Podľa tohto má IP a Krajinu písať v chate takou farbou v akom ste práve teame (CT - modrou, T - červenou, SPEC - sivou) a raz napíše modrou potom zase červenou, neviete kde je chyba?

Tu je .sma

Kód: Vybrat vše

#include <amxmodx>
#include <amxmisc>
#include <geoip>
 
#if defined _colorchat_included
  #endinput
#endif
#define _colorchat_included
 
enum Color
{
 NORMAL = 1, // culoarea jucatorilor adica fiecare ce culoare are in config
 GREEN, // verde
 TEAM_COLOR, // culoare echipa
 GREY, // gri
 RED, // rosu
 BLUE, // albastru
}
 
new const TeamName[][] =
{
 "",
 "TERRORIST",
 "CT",
 "SPECTATOR"
}
 
public plugin_init ( )
{
     register_plugin ( "Player Connect", "1.0", "C" )
}
 
public client_putinserver(player)
{
 new user[32],ip[32],Country[33]
 get_user_name(player,user,31)
 get_user_ip(player,ip,31,1)
 geoip_country(ip,Country)
 if(equal(Country,"error"))
   {
      if(contain(ip,"192.168.")==0 || equal(ip,"127.0.0.1") || contain(ip,"10.")==0 ||  contain(ip,"172.")==0)
      {
         Country = "LAN"
      }
      if(equal(ip,"loopback"))
      {
         Country = "ListenServer User"
      }
      else
      {
         Country = "Neznama Krajina"
         
   }

}

 ColorChat(0, GREEN, "%s^x01 s IP ^x03%s^x01 Sa pripojil (^x03%s^x01)", user, ip, Country )
}
 
public client_authorized(player)
{
 new user[32],ip[32],Country[33]
 get_user_name(player,user,31)
 get_user_ip(player,ip,31,1)
 geoip_country(ip,Country)
 if(equal(Country,"error"))
   {
      if(contain(ip,"192.168.")==0 || equal(ip,"127.0.0.1") || contain(ip,"10.")==0 ||  contain(ip,"172.")==0)
      {
         Country = "LAN"
      }
      if(equal(ip,"loopback"))
      {
         Country = "ListenServer User"
      }
      else
      {
         Country = "Neznama Krajina"
         
   }

}

 ColorChat(0, GREEN, "%s^x01 Sa pripaja (^x03%s^x01)", user, Country )
}

public client_disconnect(player)
{
 new user[32],ip[32],Country[33]
 get_user_name(player,user,31)
 get_user_ip(player,ip,31,1)
 geoip_country(ip,Country)
 if(equal(Country,"error"))
   {
      if(contain(ip,"192.168.")==0 || equal(ip,"127.0.0.1") || contain(ip,"10.")==0 ||  contain(ip,"172.")==0)
      {
         Country = "LAN"
      }
      if(equal(ip,"loopback"))
      {
         Country = "ListenServer User"
      }
      else
      {
         Country = "Neznama Krajina"
         
   }

}

 ColorChat(0, GREEN, "%s^x01 s IP ^x03%s^x01 Sa odpojil (^x03%s^x01)", user, ip, Country )
}

ColorChat(id, Color:type, const msg[], any:...)
{
 new message[256];
 switch(type)
 {
  case NORMAL:
  {
   message[0] = 0x01;
  }
  case GREEN:
  {
   message[0] = 0x04;
  }
  default:
  {
   message[0] = 0x03;
  }
 }
 vformat(message[1], 251, msg, 4);
 message[192] = '^0';
 new team, ColorChange, index, MSG_Type;
 
 if(id)
 {
  MSG_Type = MSG_ONE_UNRELIABLE;
  index = id;
 } else {
  index = FindPlayer();
  MSG_Type = MSG_BROADCAST;
 }
 
 team = get_user_team(index);
 ColorChange = ColorSelection(index, MSG_Type, type);
 ShowColorMessage(index, MSG_Type, message);
 
 if(ColorChange)
 {
  Team_Info(index, MSG_Type, TeamName[team]);
 }
}
ShowColorMessage(id, type, message[])
{
 static msgSayText;
 if(!msgSayText)
 {
  msgSayText = get_user_msgid("SayText");
 }
 message_begin(type, msgSayText, _, id);
 write_byte(id) 
 write_string(message);
 message_end();
}
Team_Info(id, type, team[])
{
 static msgTeamInfo;
 if(!msgTeamInfo)
 {
  msgTeamInfo = get_user_msgid("TeamInfo");
 }
 message_begin(type, msgTeamInfo, _, id);
 write_byte(id);
 write_string(team);
 message_end();
 return 1;
}
ColorSelection(index, type, Color:Type)
{
 switch(Type)
 {
  case RED:
  {
   return Team_Info(index, type, TeamName[1]);
  }
  case BLUE:
  {
   return Team_Info(index, type, TeamName[2]);
  }
  case GREY:
  {
   return Team_Info(index, type, TeamName[0]);
  }
 }
 return 0;
}
FindPlayer()
{
 new i = -1;
 while(i <= get_maxplayers())
 {
  if(is_user_connected(++i))
   return i;
 }
 return -1;


Ďakujem
Naposledy upravil(a) Branik28 dne 11 čer 2011, 06:16, celkem upraveno 1 x.

Uživatelský avatar
Qefik
Příspěvky: 5714
Registrován: 26 pro 2009, 11:26
Reputation: 0
Kontaktovat uživatele:

Re: Problém s teamcolor

#2 Příspěvekod Qefik » 03 kvě 2011, 18:48

odkaz na plugin?
Rozdávat rady je zbytečné. Moudrý si poradí sám a hlupák stejně neposlechne.
Mark Twain

Uživatelský avatar
MiniMe
Site Admin
Příspěvky: 2188
Věk: 37
Registrován: 08 pro 2009, 19:31
Reputation: 10
Kontaktovat uživatele:

Re: Problém s teamcolor

#3 Příspěvekod MiniMe » 04 kvě 2011, 00:20

Máš zaplý geoip modul?

EDIT: Koukl jsem, že máš.
FakaHeda admin
Nezapomeňte ohodnotit karmou ty, kteří Vám pomohli.

Branik28
Příspěvky: 32
Registrován: 27 úno 2011, 12:02
Reputation: 0

Re: Problém s teamcolor

#4 Příspěvekod Branik28 » 04 kvě 2011, 07:27


Uživatelský avatar
Qefik
Příspěvky: 5714
Registrován: 26 pro 2009, 11:26
Reputation: 0
Kontaktovat uživatele:

Re: Problém s teamcolor

#5 Příspěvekod Qefik » 04 kvě 2011, 15:10

nebyl by link na originální plugin? Tento jazyk neumím :)
Rozdávat rady je zbytečné. Moudrý si poradí sám a hlupák stejně neposlechne.
Mark Twain

Branik28
Příspěvky: 32
Registrován: 27 úno 2011, 12:02
Reputation: 0

Re: Problém s teamcolor

#6 Příspěvekod Branik28 » 04 kvě 2011, 19:04

Žiadny iný som nenašiel aspoň na alliedmodders nič takéto nie je

Branik28
Příspěvky: 32
Registrován: 27 úno 2011, 12:02
Reputation: 0

Re: Problém s teamcolor

#7 Příspěvekod Branik28 » 05 kvě 2011, 19:50

Žiadne riešenia?

Uživatelský avatar
Qefik
Příspěvky: 5714
Registrován: 26 pro 2009, 11:26
Reputation: 0
Kontaktovat uživatele:

Re: Problém s teamcolor

#8 Příspěvekod Qefik » 05 kvě 2011, 20:41

zkus tento plugin http://forums.alliedmods.net/showthread.php?p=555912
ale nevím, co přesně chceš aby dělal
Rozdávat rady je zbytečné. Moudrý si poradí sám a hlupák stejně neposlechne.
Mark Twain

Branik28
Příspěvky: 32
Registrován: 27 úno 2011, 12:02
Reputation: 0

Re: Problém s teamcolor

#9 Příspěvekod Branik28 » 05 kvě 2011, 21:38

Jo, tento poznám, ale v tom nie je pripájanie hráčov, hľadám pripájanie, pripojenie a odpojenie x) A nevieš kde by mohla byť chyba v tom vyššie plugine ?

Uživatelský avatar
Qefik
Příspěvky: 5714
Registrován: 26 pro 2009, 11:26
Reputation: 0
Kontaktovat uživatele:

Re: Problém s teamcolor

#10 Příspěvekod Qefik » 06 kvě 2011, 17:52

netuším, jak jsem psal, španělsky nebo v čem to je psané neumím :) ale pokud to pouze přehazuje barvy, tak to není takový problém, ne? možná právě to ten plugin má dělat.
Rozdávat rady je zbytečné. Moudrý si poradí sám a hlupák stejně neposlechne.
Mark Twain


Zpět na „Counter-Strike 1.6“

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 23 hostů