Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <fun>
- #include <hamsandwich>
- /* -------------------------------------------------------------------- */
- //
- // (.*-> Mod Loup Garou <-*.)
- //
- // Date de commencement : 25/09/2010
- //
- // Dernière mise à jour : 30/09/2010
- /* -------------------------------------------------------------------- */
- /* -------------------------------------------------------------------- */
- /* ----- CONSTANTES & MACROS ----- */
- /* -------------------------------------------------------------------- */
- #define VERSION "1.0"
- enum {HUMAIN, LOUP};
- /* -------------------------------------------------------------------- */
- /* ----- VARIABLES ----- */
- /* -------------------------------------------------------------------- */
- new Type[33];
- new NbJoueur;
- new Joueurs[32];
- new gmsgTextMsg;
- new gmsgScreenFade;
- /* -------------------------------------------------------------------- */
- /* ----- CVARS ----- */
- /* -------------------------------------------------------------------- */
- /* -------------------------------------------------------------------- */
- /* ----- INITIALISATION & CFG ----- */
- /* -------------------------------------------------------------------- */
- public plugin_init()
- {
- register_plugin("Amx_Loup_Garou", VERSION, "Mariko <3")
- //Hamsandwich
- RegisterHam(Ham_Spawn, "player", "Spawn_Joueur", 1);
- //Events
- register_event("SendAudio", "Message_Grenade", "b", "2=%!MRAD_FIREINHOLE");
- register_event("HLTV", "Nouveau_Round", "a", "1=0", "2=0");
- register_event("DeathMsg", "Joueur_Mort", "a");
- //Messages
- register_message(get_user_msgid("DeathMsg"), "Message_Mort");
- register_message(get_user_msgid("TextMsg"), "Message_Tk");
- set_msg_block(get_user_msgid("Radar"), BLOCK_SET); // Bloque le radar
- gmsgTextMsg = get_user_msgid("TextMsg");
- gmsgScreenFade = get_user_msgid("ScreenFade");
- }
- public plugin_cfg()
- {
- set_cvar_string("mp_playerid", "2"); // On ne voit pas les pseudos
- set_cvar_string("mp_friendlyfire", "1"); // Tir allié autorisé
- set_cvar_string("mp_limitteams","0");
- set_cvar_string("mp_autoteambalance","0");
- set_cvar_string("mp_autokick","0");
- set_cvar_string("mp_freezetime","2");
- }
- public client_connect(id)
- {
- Type[id] = HUMAIN;
- return PLUGIN_CONTINUE;
- }
- public client_disconnect(id)
- {
- Type[id] = HUMAIN;
- return PLUGIN_CONTINUE;
- }
- /* -------------------------------------------------------------------- */
- /* ----- EVENTS & MSG ----- */
- /* -------------------------------------------------------------------- */
- // ---------------------------------------------
- // Répartit les rôles (Loup, Humain .. )
- public Nouveau_Round()
- {
- get_players(Joueurs, NbJoueur);
- End = 0;
- new lg = Joueurs[random(NbJoueur)];
- for(new id, i = 0 ; i < NbJoueur ; i++)
- {
- id = Joueurs[i];
- Type[id] = (id == lg) ? LOUP : HUMAIN;
- }
- }
- // ---------------------------------------------
- // Spawn du joueur
- public Spawn_Joueur(id)
- {
- if(is_user_alive(id))
- {
- cs_set_user_team(id ,CS_TEAM_CT, CS_CT_GIGN);
- client_cmd(id,"hideradar");
- strip_user_weapons(id);
- give_item(id, "weapon_knife");
- give_item(id, "weapon_deagle");
- cs_set_user_bpammo(id, CSW_DEAGLE,70);
- give_item(id, "weapon_m4a1");
- cs_set_user_bpammo(id, CSW_M4A1, 150);
- give_item(id, "weapon_ak47");
- cs_set_user_bpammo(id, CSW_AK47, 150);
- cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM);
- switch(Type[id])
- {
- case LOUP:
- {
- print_color(id, id, 0,"^x04[Loup-Garou]^x01 Vous etes le Loup-Garou !");
- print_color(id, id, 0,"^x04[Loup-Garou]^x01 Eliminez vos ennemis sans vous faire remarquer !");
- FadeEffect(id, 0x00FF0000, 128, 2);
- }
- case HUMAIN:
- {
- print_color(id, id, 0,"^x04[Loup-Garou]^x01 Un traitre se cache parmis vous ...");
- print_color(id, id, 0,"^x04[Loup-Garou]^x01 Eliminez-le !");
- FadeEffect(id, 0x000000FF, 128, 2);
- }
- }
- }
- }
- // ---------------------------------------------
- // Gère les kills et le score
- public Joueur_Mort()
- {
- if(End) return PLUGIN_CONTINUE;
- get_players(Joueurs, NbJoueur);
- new idT = read_data(1);
- new idV = read_data(2);
- if(is_user_connected(idT) && is_user_connected(idV) && idT != idV)
- {
- if(Type[idT] == LOUP && Type[idV] == HUMAIN)
- {
- new NomV[32];
- get_user_name(idV, NomV, charsmax(NomV));
- print_color(0, idV, 0,"^x04[Loup-Garou]^x01 %s s'est fait avoir !", NomV);
- set_user_frags(idT, get_user_frags(idT) + 1); // -1 pour le frag, donc +1 - 1 = 0
- }
- else if(Type[idT] == HUMAIN && Type[idV] == LOUP)
- {
- new NomT[32];
- get_user_name(idT, NomT, charsmax(NomT));
- set_user_frags(idT, get_user_frags(idT) + 6); // -1 pour le frag, donc +6 - 1 = +5
- print_color(0, idT, 0,"^x04[Loup-Garou]^x01 %s vient d'eliminer le traitre ! On ne l'a lui fait pas !", NomT);
- }
- else if(Type[idT] == Type[idV])
- {
- new NomV[32];
- get_user_name(idV, NomV, charsmax(NomV));
- print_color(0, idV, 0,"^x04[Loup-Garou]^x01 %s s'est fait avoir !", NomV);
- set_user_frags(idT, get_user_frags(idT) + 1); // -1 pour le frag, donc +1 - 1 = 0
- print_color(idT, idT, 0,"^x04[Loup-Garou]^x01 Tu as perdu ...");
- user_kill(idT);
- }
- }
- new nbA = 0;
- for(new i = 0, id ; i < NbJoueur ; i++)
- {
- id = Joueurs[i];
- if(is_user_alive(id)) nbA++;
- else if(Type[id] == LOUP) End = 1;
- }
- if(nbA < 2) End = 1;
- if(End) Fin_Round();
- return PLUGIN_CONTINUE;
- }
- // ---------------------------------------------
- // Cache les kills du loup
- public Message_Mort()
- {
- new idT = get_msg_arg_int(1);
- if (is_user_alive(idT) && Type[idT] == LOUP)
- {
- new idV = get_msg_arg_int(2);
- set_msg_arg_int(1, ARG_BYTE, idV);
- }
- return PLUGIN_CONTINUE;
- }
- // ---------------------------------------------
- // Cache les messages TK
- public Message_Tk(iMsgId, iMsgDest, id)
- {
- if(id && get_msg_arg_int(1) == print_chat)
- {
- new szMessage[23]; // #Game_teammate_attack
- get_msg_arg_string(2, szMessage, charsmax(szMessage));
- if(equal(szMessage, "#Game_teammate_attack"))
- {
- return PLUGIN_HANDLED;
- }
- }
- return PLUGIN_CONTINUE;
- }
- // ---------------------------------------------
- // Bloque le message grenade
- public Message_Grenade()
- {
- if(get_msg_block(gmsgTextMsg) != BLOCK_SET)
- {
- set_msg_block(gmsgTextMsg, BLOCK_ONCE);
- }
- return PLUGIN_CONTINUE;
- }
- /* -------------------------------------------------------------------- */
- /* ----- FONCTIONS ----- */
- /* -------------------------------------------------------------------- */
- public FadeEffect(id, color, alpha, time)
- {
- message_begin(MSG_ONE_UNRELIABLE,gmsgScreenFade,{0,0,0},id);
- write_short(4096 * time);
- write_short(4096 * time);
- write_short(4096);
- write_byte((color & 0x00FF0000) >> 16);
- write_byte((color & 0x0000FF00) >> 8);
- write_byte((color & 0x000000FF));
- write_byte(alpha);
- message_end();
- }
- // ---------------------------------------------
- // Termine le round
- public Fin_Round()
- {
- get_players(Joueurs, NbJoueur, "ah");
- print_color(0, 1, 0,"^x04[Loup-Garou]^x01 Nouvelle partie en preparation ...");
- for(new i = 0, id ; i < NbJoueur ; i++)
- {
- id = Joueurs[i];
- user_kill(id);
- }
- }
- /* -------------------------------------------------------------------- */
- /* ----- CHAT EN COULEUR ----- */
- /* -------------------------------------------------------------------- */
- public print_color(id, cid, color, const message[], any:...)
- {
- new msg[192];
- vformat(msg, charsmax(msg), message, 5);
- new param;
- if (!cid) return;
- else param = cid;
- new team[32];
- get_user_team(param, team, 31);
- switch (color)
- {
- case 0: msg_teaminfo(param, team);
- case 1: msg_teaminfo(param, "TERRORIST");
- case 2: msg_teaminfo(param, "CT");
- case 3: msg_teaminfo(param, "SPECTATOR");
- }
- if(id) msg_saytext(id, param, msg);
- else msg_saytext(0, param, msg);
- if (color != 0) msg_teaminfo(param, team);
- }
- msg_saytext(id, cid, msg[])
- {
- message_begin(id?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id);
- write_byte(cid);
- write_string(msg);
- message_end();
- }
- msg_teaminfo(id, team[])
- {
- message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id);
- write_byte(id);
- write_string(team);
- message_end();
- }
Add Comment
Please, Sign In to add comment