Offline |
 |
 |
Csatlakozott:2016.02.04. 10:58 Hozzászólások:219 Megköszönt másnak: 11 alkalommal Megköszönték neki: 18 alkalommal
|
Hali, ezt a 2 plugint egybe lehetne írni? Mármint a rang rendszerhez hozzá dobni a chat tipust. pl: [A.D.M.I.N] [TÚLÉLŐ] Player: Köszönöm előre!  #include <amxmodx> #include <amxmisc> #include <cstrike> #include <csstats> #pragma tabsize 0 #define PLUGIN "Rankrendszer (HUD + prefix)" #define VERSION "1.5" #define AUTHOR "6lmasok,qKKKJ;>, RaZ_HU" #define ACCESS_LEVEL ADMIN_CHAT #define ADMIN_LISTEN ADMIN_CHAT #define RANK_SILVER 0 #define RANK_SILVER2 1 #define RANK_SILVER3 2 #define RANK_SILVER4 3 #define RANK_SILVERE 4 #define RANK_SILVEREM 5 #define RANK_NOVA 6 #define RANK_NOVA2 7 #define RANK_NOVA3 8 #define RANK_NOVAM 9 #define RANK_AK 10 #define RANK_AK2 11 #define RANK_DAK 12 #define RANK_SHERIFF 13 #define RANK_SAS 14 #define RANK_SASM 15 #define RANK_SUPREME 16 #define RANK_GLOBAL 17 #define RANK_UBER 18 #define MAXRANKS 19 new message[192] new strName[191] new strText[191] new sayText new teamInfo new maxPlayers new PlayerRank[33] new Float:HUD_INTERVAL new static color[10] new const RANKS[MAXRANKS][] = { "Féreg", "Zöld FülŰ", "Zombie", "Zombie |", "Zombie ||", "Zombie |||", "Zombie ||||", "Zombie Hytech", "NemesiS", "NemesiS |", "NemesiS ||", "NemesiS |||", "NemesiS ||||", "NemesiS PRO", "AssaSSinS", "AssaSSinS |", "AssaSSinS ||", "AssaSSinS |||", "BOSS PRO KILLER" } #define size 18 new const szamok[size] = { 50, 100, 200, 300, 450, 650, 800, 1000, 1200, 2400, 3700, 4000, 5500, 6000, 7600, 8500, 9500, 10000 } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /rang", "hud") register_clcmd("say rang", "hud") register_clcmd ("say", "hook_say") register_clcmd ("say_team", "hook_teamsay") register_cvar("sv_rankrendszer","1") // A plugin be- illetve kikapcsolása register_cvar("sv_rankrendszer_HUD","0") // A HUD-ra való kijelzés be- illetve kikapcsolása sethudtime() sayText = get_user_msgid ("SayText") teamInfo = get_user_msgid ("TeamInfo") maxPlayers = get_maxplayers() set_task(160.0, "korUzenet", 0, _, _, "b") register_message (sayText, "avoid_duplicated") } public sethudtime() { new refreshtime = register_cvar("sv_rankrendszer_HUDtime","0.9") // A HUD-ra való kijelzés frissítési ideje másodpercben if (refreshtime == 0.9) { HUD_INTERVAL = 0.9 } else if (refreshtime != 0.9) { HUD_INTERVAL = get_pcvar_float(refreshtime) } return PLUGIN_CONTINUE } public avoid_duplicated (msgId, msgDest, receiver) { return PLUGIN_HANDLED } public korUzenet() { ColorChat( 0, "^3Írd be ^4/rang ^3vagy ^4rang ^3hogy megnézd hány ölés kell a következő ranghoz.") return PLUGIN_HANDLED; } public hud(id) { new stats[8] new bodyhits[8] get_user_stats(id, stats, bodyhits) ColorChat( id, "^4Rangod: ^3%s ^1| ^4Ölések: ^3%d",RANKS[PlayerRank[id]], stats[0]) if(PlayerRank[id] == MAXRANKS-1) { //client_print(id, print_chat, "^4Rangod: ^3%s ^1| ^4Öléseid: ^3%d ^n^4A következő szinthez kell még: ^3%d",RANKS[PlayerRank[id]], stats[0],szamok[PlayerRank[id]]-stats[0]) ColorChat( id, "^4Már elérted a legnagyobb ^4rangot.") } else { //client_print(id, print_chat, "^4Rangod: ^3%s ^1| ^4Öléseid: ^3%d ^n^4Már elérted a legnagyobb rangot.",RANKS[PlayerRank[id]], stats[0]) ColorChat( id, "^4Következő rang: ^3%s ^1| ^4A következő szinthez kell még: ^3%d",RANKS[PlayerRank[id]+1], szamok[PlayerRank[id]]-stats[0]) } } public hook_say(id) { read_args (message, 191) remove_quotes (message) if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) // Ignores Admin Hud Messages, Admin Slash commands, return PLUGIN_CONTINUE new name[32] get_user_name (id, name, 31) new isAlive, alive[32] if (is_user_alive (id)) { isAlive = 1 alive = "^1 " } else { isAlive = 0 alive = "^1*HALOTT* " } //static color[10] if(get_user_flags(id)&ADMIN_BAN) { //get_user_team (id, color, 9) getTeam(id) format (strName, 191, "%s^4[A.D.M.I.N]^1[%s] ^4%s:", alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^3%s", message) } else if(get_user_flags(id)&ADMIN_MAP) { getTeam(id) format (strName, 191, "%s^4[P.R.É.M V.I.P]^1[%s]", alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^1%s", message) } else if(get_user_flags(id)&ADMIN_LEVEL_H) { getTeam(id) format (strName, 191, "%s^4[V.I.P]^1[%s] ^3%s:", alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^1%s", message) } else if(get_user_flags(id)&ADMIN_USER) { getTeam(id) format (strName, 191, "%s^4[%s] ^3%s:",alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^1%s", message) } format (message, 191, "%s ^1%s", strName, strText) sendMessage (color, isAlive) return PLUGIN_CONTINUE } public hook_teamsay(id) { new playerTeam = get_user_team(id) new playerTeamName[19] switch (playerTeam) { case 1: copy (playerTeamName, 11, "Terrorista") case 2: copy (playerTeamName, 18, "Anti-Terrorista") default: copy (playerTeamName, 9, "Néző") } read_args (message, 191) remove_quotes (message) if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) return PLUGIN_CONTINUE new isAlive, alive[32] if (is_user_alive (id)) { isAlive = 1 alive = "^1 " } else { isAlive = 0 alive = "^1*HALOTT* " } new name[32] get_user_name (id, name, 31) //static color[10] if(get_user_flags(id)&ADMIN_BAN) { //get_user_team (id, color, 9) getTeam(id) format (strName, 191, "%s^4[A.D.M.I.N]^1[%s] ^4%s:", alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^3%s", message) } else if(get_user_flags(id)&ADMIN_MAP) { getTeam(id) format (strName, 191, "%s^4[P.R.É.M V.I.P]^1[%s] ^4%s:", alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^1%s", message) } else if(get_user_flags(id)&ADMIN_LEVEL_H) { getTeam(id) format (strName, 191, "%s^4[V.I.P]^1[%s] ^4%s:", alive, RANKS[PlayerRank[id]], name) format (strText, 191, "^1%s", message) } else if(get_user_flags(id)&ADMIN_USER) { getTeam(id) format (strName, 191, "%s(%s)^4[%s] ^3%s:",alive ,playerTeamName, RANKS[PlayerRank[id]], name) format (strText, 191, "^1%s", message) } format (message, 191, "%s ^1%s", strName, strText) sendTeamMessage (color,isAlive, playerTeam) return PLUGIN_CONTINUE } public sendMessage (color[], alive) { new teamName[10] for (new player = 1; player < maxPlayers; player++) { if (!is_user_connected(player)) continue if((alive && is_user_alive(player)) || (!alive && !is_user_alive(player)) || (get_user_flags(player) && ADMIN_LISTEN)) { get_user_team (player, teamName, 9) changeTeamInfo (player, color) writeMessage (player, message) changeTeamInfo (player, teamName) } } } public sendTeamMessage (color[], alive, playerTeam) { new teamName[10] for (new player = 1; player < maxPlayers; player++) { if (!is_user_connected(player)) continue if (get_user_team(player) == playerTeam || get_user_flags(player) & ADMIN_LISTEN) { if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_user_flags(player) & ADMIN_LISTEN) { get_user_team (player, teamName, 9) changeTeamInfo (player, color) writeMessage (player, message) changeTeamInfo (player, teamName) } } } } public changeTeamInfo (player, team[]) { message_begin (MSG_ONE, teamInfo, _, player) write_byte (player) write_string (team) message_end() } public writeMessage (player, message[]) { message_begin (MSG_ONE, sayText, {0, 0, 0}, player) write_byte (player) write_string (message) message_end () } stock bool:is_user_steam(id) { static dp_pointer; if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider"))) { server_cmd("dp_clientinfo %d", id); server_exec(); return (get_pcvar_num(dp_pointer) == 2) ? true : false; } return false; } public client_putinserver(id) { if(get_cvar_num("sv_rankrendszer")==0) { return PLUGIN_HANDLED } else if (get_cvar_num("sv_rankrendszer")==1 && get_cvar_num("sv_rankrendszer_HUD")==1) { set_task(HUD_INTERVAL, "setDisplay", id) } else { set_task(0.5, "remTask", id) } return PLUGIN_CONTINUE } public remTask(id) { remove_task(id, 0) } public getTeam(id) { get_user_team (id, color, 9) } public setDisplay(id) { if(!is_user_connected(id)) return PLUGIN_CONTINUE new stats[8] new bodyhits[8] get_user_stats(id, stats, bodyhits) if(stats[0] < 50) { PlayerRank[id] = RANK_SILVER } else if(stats[0] >= 50 && stats[0] < 100) { PlayerRank[id] = RANK_SILVER2 } else if(stats[0] >= 100 && stats[0] < 200) { PlayerRank[id] = RANK_SILVER3 } else if(stats[0] >= 200 && stats[0] < 300) { PlayerRank[id] = RANK_SILVER4 } else if(stats[0] >= 300 && stats[0] < 450) { PlayerRank[id] = RANK_SILVERE } else if(stats[0] >= 450 && stats[0] < 650) { PlayerRank[id] = RANK_SILVEREM } else if(stats[0] >= 650 && stats[0] < 800) { PlayerRank[id] = RANK_NOVA } else if(stats[0] >= 800 && stats[0] < 1000) { PlayerRank[id] = RANK_NOVA2 } else if(stats[0] >= 1000 && stats[0] < 1200) { PlayerRank[id] = RANK_NOVA3 } else if(stats[0] >= 1200 && stats[0] < 2400) { PlayerRank[id] = RANK_NOVAM } else if(stats[0] >= 2400 && stats[0] < 3700) { PlayerRank[id] = RANK_AK } else if(stats[0] >= 3700 && stats[0] < 4000) { PlayerRank[id] = RANK_AK2 } else if(stats[0] >= 4000 && stats[0] < 5500) { PlayerRank[id] = RANK_DAK } else if(stats[0] >= 5500 && stats[0] < 6000) { PlayerRank[id] = RANK_SHERIFF } else if(stats[0] >= 6000 && stats[0] < 7600) { PlayerRank[id] = RANK_SAS } else if(stats[0] >= 7600 && stats[0] < 8500) { PlayerRank[id] = RANK_SASM } else if(stats[0] >= 8500 && stats[0] < 9500) { PlayerRank[id] = RANK_SUPREME } else if(stats[0] >= 9500 && stats[0] < 10000) { PlayerRank[id] = RANK_GLOBAL } else if(stats[0] >= 10000) { PlayerRank[id] = RANK_UBER } set_hudmessage(142, 239, 39, 0.01, 0.20, 0, 6.0, 1.0, 0.0, 0.0, -1) show_hudmessage(id, "", stats[0], RANKS[PlayerRank[id]]) //show_hudmessage(id, "%s ^nÖléseid:[%i] ^nRang:[%s]", name, stats[0], RANKS[PlayerRank[id]]) set_task(HUD_INTERVAL, "setDisplay", id) return PLUGIN_CONTINUE } stock ColorChat(const id, const input[], any:...) { new count = 1, players[32]; static msg[191]; vformat(msg, 190, input, 3); replace_all(msg, 190, "!g", "^4"); // Green Color replace_all(msg, 190, "!y", "^1"); // Default Color replace_all(msg, 190, "!t", "^3"); // Team Color if (id) players[0] = id; else get_players(players, count, "ch"); { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } } }
/***************************************************************************\ ===================================== * || [ZP] Classes In Chat v1.1 || * ===================================== ------------------- *||DESCRIPTION||* ------------------- This plugins adds classes in chat for eg: If a person is survivor and he says something then this is what it would look like [Survivor] Player: Hi I am a survivor To make the chat more interesting, the chat is in colors Original Plugin thread is located here: http://forums.alliedmods.net/showthread.php?t=120557 --------------- *||CREDITS||* --------------- - MeRcyLeZZ ----> For some of the natives - My Sister ----> For taking the some screen shots ------------------ *||CHANGE LOG||* ------------------ v1.0 ====> - Initial Release v1.0 ====> - Re-wrote the whole plugin - Removed the color chat include and added a new color chat system. - Fixed almost, all the bugs which were reported \***************************************************************************/ #include <amxmodx> #include <cstrike> #include <zombieplague> // Variables new g_msg_saytext, g_msg_teaminfo, g_new_round // Team names used by the team info message new const team_names[][] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" } // Color indexes for color chat message enum { RED = 1, BLUE, GREY } public plugin_init() { // Register the plugin register_plugin("[ZP] Classes In Chat", "1.1", "@bdul!") // Client say commands register_clcmd("say", "hook_say") register_clcmd("say_team", "hook_team_say") // Round start event register_event("HLTV", "event_round_start", "a", "1=0", "2=0") // Message IDs' g_msg_saytext = get_user_msgid("SayText") g_msg_teaminfo = get_user_msgid("TeamInfo") // This var should be set true to prevent a bug g_new_round = true } // Check for new round and update the var accordingly public event_round_start() g_new_round = true public zp_round_started() g_new_round = false // Player's chat hook public hook_say(id) { // Retrieve the player's chat static chat[192], name[32], users_team read_args(chat, 191) remove_quotes(chat) // Trying to fool us ? if(!chat[0]) return PLUGIN_CONTINUE // Retrieve player's name get_user_name(id, name, charsmax(name)) // Retrieve player's team users_team = _:cs_get_user_team(id) // Alive user chat if (is_user_alive(id)) { if (zp_get_user_zombie(id)) color_chat(0, id, users_team, RED, "^3[%s]^4 %s:^1 %s", zp_get_user_nemesis(id) ? "Nemesis" : "Zombie", name, chat) else color_chat(0, id, users_team, BLUE, "^3[%s]^4 %s:^1 %s", zp_get_user_survivor(id) ? "Survivor" : "Human", name, chat) } // Dead user's chat else color_chat(0, id, users_team, users_team, "^3[%s]^4 %s:^1 %s", users_team == _:CS_TEAM_SPECTATOR ? "SPEC" : "DEAD", name, chat) return PLUGIN_HANDLED } // Player's team say hook public hook_team_say(id) { // Retrieve the player's chat static chat[192], name[32], users_team read_args(chat, 191) remove_quotes(chat) // Trying to fool us ? if(!chat[0]) return PLUGIN_CONTINUE // Retrieve player's name get_user_name(id, name, charsmax(name)) // Retrieve player's team users_team = _:cs_get_user_team(id) // Alive user if (is_user_alive(id)) { if (zp_get_user_zombie(id)) color_chat(1, id, users_team, RED, "^3[%s](Team Message)^4 %s:^1 %s", zp_get_user_nemesis(id) ? "Nemesis" : "Zombie", name, chat) else color_chat(g_new_round ? 0 : 1, id, users_team, BLUE, "^3[%s](Team Message)^4 %s:^1 %s", zp_get_user_survivor(id) ? "Survivor" : "Human", name, chat) } // Dead user's chat else color_chat(1, id, users_team, users_team, "^3[%s](Team Message)^4 %s:^1 %s", users_team == _:CS_TEAM_SPECTATOR ? "SPEC" : "DEAD", name, chat) return PLUGIN_HANDLED } // An improved color chat function color_chat(team_format, player, player_team, color, const chat_msg[], ...) { // Format the chat message static msg[192] vformat(msg, charsmax(msg) - 1, chat_msg, 6) // We need to display the chat message to only the player's team if (team_format) { // Get amount of players present static id, i, players[32], count get_players(players, count, "e", team_names[player_team]) // Loop through them for (i = 0; i < count; i++) { // Save player's id so we dont re-index id = players[i] // Just in case... if (!id) continue; // Send the colored text message message_begin(MSG_ONE_UNRELIABLE, g_msg_saytext, _, id) write_byte(player) write_string(msg) message_end() } } else { // Do we need to change the player's team ? if (player_team == color) { // Send the colored text message message_begin(MSG_BROADCAST, g_msg_saytext) write_byte(player) write_string(msg) message_end() } else { // Change his team first message_begin(MSG_BROADCAST, g_msg_teaminfo) write_byte(player) write_string(team_names[color]) message_end() // Send the colored text message message_begin(MSG_BROADCAST, g_msg_saytext) write_byte(player) write_string(msg) message_end() // Restore player's team message_begin(MSG_BROADCAST, g_msg_teaminfo) write_byte(player) write_string(team_names[player_team]) message_end() } } }
_________________ STEAM[steam]konfigos[/steam]YOUTUBESzerverek  _ 
|
|