RESETSCORE COLORAT

Pluginuri pentru modul AmxModX.
Post Reply
RoberTo
Global Moderator
Global Moderator
Posts: 1380
Joined: Sun Dec 26, 2010 9:31 pm
Jucator SA:MP ?: Da
Nick:: RoberTo
Jucator CS ?: Da
Location: Craiova
Contact:

RESETSCORE COLORAT

Post by RoberTo »

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#pragma semicolon 1

//Colorchat
enum Color {
   NORMAL = 1, // clients scr_concolor cvar color
   GREEN, // Green Color
   TEAM_COLOR, // Red, grey, blue
   GREY, // grey
   RED, // Red
   BLUE, // Blue
};

new TeamName[][] = {
   "",
   "TERRORIST",
   "CT",
   "SPECTATOR"
};

//Cvar-uri
new cvar_chat;
new cvar_on;
new cvar_dead;
new cvar_tag;
new cvar_time;

public plugin_init() {
   register_plugin("Resetscore", "3.1", "Ex3cuTion");
   
   register_clcmd("say /resetscore", "cmdReset");
   register_clcmd("say /rs","cmdReset");
   register_clcmd("say_team /resetscore", "cmdReset");
   register_clcmd("/resetscore", "cmdReset");
   
   cvar_chat = register_cvar("amx_reset_chat", "1");
   cvar_on = register_cvar("amx_reset_plugin", "1");
   cvar_dead = register_cvar("amx_reset_dead","1");
   cvar_tag = register_cvar("amx_reset_tag","ResetScore");
   cvar_time = register_cvar("amx_reset_time","60");
   
   if(get_pcvar_num(cvar_chat) == 1) {
      new Float:timp = get_pcvar_float(cvar_time);
      set_task(timp, "chatmsgshow",_,_,_,"b",0);
   }
}

public cmdReset(id) {
   new tag[32];
   new g_Tag = get_pcvar_string(cvar_tag,tag,31);
   
   if(get_pcvar_num(cvar_on) == 0) {
      ColorChat(id,GREEN,"[%s]^x01 Pluginul este dezactivat",g_Tag);
      return PLUGIN_HANDLED;
   }
   if(get_pcvar_num(cvar_dead) == 0 && !is_user_alive(id)) {
      ColorChat(id, GREEN, "[%s]^x01 Poti folosii comanda numai atunci cand esti viu",g_Tag);
      return PLUGIN_HANDLED;
   }
   
   new frags = get_user_frags(id);
   new deaths = get_user_deaths(id);
   
   if(frags == 0 && deaths == 0) {
      ColorChat(id, GREEN, "[%s]^x01 Scorul tau este deja: %d - %d",g_Tag,frags,deaths);
      return PLUGIN_HANDLED;
   }
   
   new nick[32];
   get_user_name(id, nick, 31);
   
   cs_set_user_deaths(id, 0);
   set_user_frags(id, 0);
   cs_set_user_deaths(id, 0);
   set_user_frags(id, 0);
   
   new frags2 = get_user_frags(id);
   new deaths2 = get_user_deaths(id);
   
   ColorChat(id, GREEN, "[%s]^x01 Scorul tau este acum^x04 %d - %d",g_Tag,frags2,deaths2);
   ColorChat(0,GREEN,"[%s]^x01 si-a resetat scorul",nick);
   
   return PLUGIN_HANDLED;
}
public chatmsgshow(id) {
   new tag[32];
   new g_Tag = get_pcvar_string(cvar_tag,tag,31);
   
   ColorChat(id, GREEN, "[%s]^x01 Daca vrei sa iti resetezi scorul,foloseste comanda^x03 /resetscore^x01 sau^x03 /rs!",g_Tag);
}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
   if( !get_playersnum() ) return;
   
   new message[256];

   switch(type)
   {
      case NORMAL: // clients scr_concolor cvar color
      {
         message[0] = 0x01;
      }
      case GREEN: // Green
      {
         message[0] = 0x04;
      }
      default: // White, Red, Blue
      {
         message[0] = 0x03;
      }
   }

   vformat(message[1], 251, msg, 4);

   // Make sure message is not longer than 192 character. Will crash the server.
   message[192] = '^0';

   new team, ColorChange, index, MSG_Type;
   
   if(id)
   {
      MSG_Type = MSG_ONE;
      index = id;
   } else {
      index = FindPlayer();
      MSG_Type = MSG_ALL;
   }
   
   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 bool:saytext_used;
   static get_user_msgid_saytext;
   if(!saytext_used)
   {
      get_user_msgid_saytext = get_user_msgid("SayText");
      saytext_used = true;
   }
   message_begin(type, get_user_msgid_saytext, _, id);
   write_byte(id);
   write_string(message);
   message_end();   
}

Team_Info(id, type, team[])
{
   static bool:teaminfo_used;
   static get_user_msgid_teaminfo;
   if(!teaminfo_used)
   {
      get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
      teaminfo_used = true;
   }
   message_begin(type, get_user_msgid_teaminfo, _, 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;
} 
Vrei un host de calitate si serios pentru serverul tau?
VEZI SERVERE HOSTATE LA NOI : http://www.zonek.ro/index.php?option=com_lgsl&Itemid=5
0763.55.9997 Comanda ACUMA OFERTA LIMITATA
Y: zonek_telecom | http://www.zonek.ro
- Nu te baga in pat nervos, stai treaz si "lupta". http://forum.zonek.ro inscrie-te si vezi cum se manifesta...
- Pentru schimb de Linkuri Intra AICi : linkex
Image
- Pentru cereri de Parteneriate prin Bannere Intra AICI
Image
Image
onLy
Jr. Member
Jr. Member
Posts: 136
Joined: Sun Nov 06, 2011 4:36 pm

Re: RESETSCORE COLORAT

Post by onLy »

gg daca e facut de tine:))))
RoberTo
Global Moderator
Global Moderator
Posts: 1380
Joined: Sun Dec 26, 2010 9:31 pm
Jucator SA:MP ?: Da
Nick:: RoberTo
Jucator CS ?: Da
Location: Craiova
Contact:

Re: RESETSCORE COLORAT

Post by RoberTo »

nui facut de mn :P
Vrei un host de calitate si serios pentru serverul tau?
VEZI SERVERE HOSTATE LA NOI : http://www.zonek.ro/index.php?option=com_lgsl&Itemid=5
0763.55.9997 Comanda ACUMA OFERTA LIMITATA
Y: zonek_telecom | http://www.zonek.ro
- Nu te baga in pat nervos, stai treaz si "lupta". http://forum.zonek.ro inscrie-te si vezi cum se manifesta...
- Pentru schimb de Linkuri Intra AICi : linkex
Image
- Pentru cereri de Parteneriate prin Bannere Intra AICI
Image
Image
Post Reply

Return to “AmxModX”