Stránka 1 z 2

Problém s teamcolor

Napsal: 03 kvě 2011, 17:35
od Branik28
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

Re: Problém s teamcolor

Napsal: 03 kvě 2011, 18:48
od Qefik
odkaz na plugin?

Re: Problém s teamcolor

Napsal: 04 kvě 2011, 00:20
od MiniMe
Máš zaplý geoip modul?

EDIT: Koukl jsem, že máš.

Re: Problém s teamcolor

Napsal: 04 kvě 2011, 07:27
od Branik28

Re: Problém s teamcolor

Napsal: 04 kvě 2011, 15:10
od Qefik
nebyl by link na originální plugin? Tento jazyk neumím :)

Re: Problém s teamcolor

Napsal: 04 kvě 2011, 19:04
od Branik28
Žiadny iný som nenašiel aspoň na alliedmodders nič takéto nie je

Re: Problém s teamcolor

Napsal: 05 kvě 2011, 19:50
od Branik28
Žiadne riešenia?

Re: Problém s teamcolor

Napsal: 05 kvě 2011, 20:41
od Qefik
zkus tento plugin http://forums.alliedmods.net/showthread.php?p=555912
ale nevím, co přesně chceš aby dělal

Re: Problém s teamcolor

Napsal: 05 kvě 2011, 21:38
od Branik28
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 ?

Re: Problém s teamcolor

Napsal: 06 kvě 2011, 17:52
od Qefik
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.