RSSy MYGO.pl Opublikowano Marzec 5, 2020 o 16:08 RSSy Udostępnij Opublikowano Marzec 5, 2020 o 16:08 D i 5 7 i n c T's Kill Assist Enables kill assist. The player who has done the most damage to the killed victim(including the victim itself) will be shown as an assister in the death(frag) message. Uses fake name change by sending messages to clients instead of changing it server-side, eliminating any compatibility issues with other plug-ins that rely on player name such as ranking plug-ins, etc. Joined name parts are guaranteed to be different for better readability and equal in length at the same time. Runs on any GoldSource(Half-Life 1) engine game. Supports Counter-Strike: Condition Zero bots. None. None. This plug-in requires the following: - Ham Bots API. Latest version as of 2015 December 22 of the script(cs_ham_bots_api.sma) and include(cs_ham_bots_api.inc) are attached along below. To disable support for CZ bots or if there are any mod compatibility issues because of it, simply comment #include <cs_ham_bots_api> and recompile. - BitSum stocks include file (bitsums.inc). Attached along below. Change the killer and assister names joiner by editing the following string and recompiling: new const g_szNameJoiner[] = " + "; Get source and compile locally. Spection - For his CS Revo Kill Assist plug-in from which I got the fake name change code. MeRcyLeZZ - For his HamSandwich register bots API. dorin2oo7 - For his images I used to style up my post. NiHiLaNTh, schmurgel1983, KliPPy, meTaLiCroSS - For being true friends and always helping and teaching me new stuff. Code: T = needs testing X = done - = cancelled [-] re-write with manual death message sending and restore name on name change(pre or post) [X] re-write with fake name change(SVC_UPDATEUSERINFO) v1.0.0 [T] fix damage taken not resetting for spawned player v1.0.1 [ ] add individual messages for hltv [ ] add minimum damage required to consider as assist [ ] add forwards for sub-plugins [ ] Code(for easy readability): PHP Code: // Modules#include <amxmodx>#include <fakemeta>#include <hamsandwich>// Plug-in APIs#include <cs_ham_bots_api>// Stocks#include <bitsums>//#include <D7Debug>const g_iSizeName = 31;new g_iMaxPlayers,Float:g_fDamage[33][33],g_iBsConnected,g_iBsNameRestore;new const g_szNameJoiner[] = " + ";public plugin_init(){ register_plugin("D7 Kill assist", "1.0.1", "D i 5 7 i n c T, Spection") //register_event("HLTV", "fwEvHltvRoundStart", "a", "1=0", "2=0") RegisterHam(Ham_Spawn, "player", "fwHamSpawnPlayer", 1) RegisterHam(Ham_TakeDamage, "player", "fwHamTakeDamagePlayer", 1) RegisterHam(Ham_Killed, "player", "fwHamKilledPlayerPre") RegisterHam(Ham_Killed, "player", "fwHamKilledPlayer", 1) #if defined _cs_ham_bots_api_included RegisterHamBots(Ham_Spawn, "fwHamSpawnPlayer", 1) RegisterHamBots(Ham_TakeDamage, "fwHamTakeDamagePlayer", 1) RegisterHamBots(Ham_Killed, "fwHamKilledPlayerPre") RegisterHamBots(Ham_Killed, "fwHamKilledPlayer", 1) #endif g_iMaxPlayers = get_maxplayers();/* register_clcmd("say /tmulti", "fwClCmdSayTestMulti") register_clcmd("say /tdead", "fwClCmdSayTestDead") register_clcmd("say /tmultidead", "fwClCmdSayTestMultiDead") register_clcmd("say /rs", "fwClCmdSayRespawn")*/}/*public fwEvHltvRoundStart(){ client_print(0, print_center, "Round start") for (new iID = 1; iID <= g_iMaxPlayers; iID++) g_fDamage[iID] = Float:"";}*/public client_putinserver(iID){ #if AMXX_VERSION_NUM <= 182 set_task(0.1, "fwTaskPlayerCheckConnected", iID, _, _, "b") #endif bitsum_add(g_iBsConnected, iID)}#if AMXX_VERSION_NUM <= 182public fwTaskPlayerCheckConnected(const iID){ if (bitsum_get(g_iBsConnected, iID) && !is_user_connected(iID)) { client_disconnect(iID) }}public client_disconnect(iID)#elsepublic client_disconnected(iID)#endif{ #if AMXX_VERSION_NUM <= 182 remove_task(iID) #endif bitsum_del(g_iBsConnected, iID) for (new iID2 = 1; iID2 <= g_iMaxPlayers; iID2++) { g_fDamage[iID][iID2] = 0.0; g_fDamage[iID2][iID] = 0.0; }}public fwHamSpawnPlayer(const iID){ if (!is_user_alive(iID)) return; for (new iID2 = 1; iID2 <= g_iMaxPlayers; iID2++) { g_fDamage[iID2][iID] = 0.0; }}public fwHamTakeDamagePlayer(const iIDVictim, const iIDInflictor, const iIDAttacker, const Float:fDamage)//, const iBsDamageType{ if (!(0 <= iIDAttacker <= g_iMaxPlayers) || GetHamReturnStatus() == HAM_SUPERCEDE) return; if (iIDAttacker) g_fDamage[iIDAttacker][iIDVictim] += fDamage; else g_fDamage[iIDVictim][iIDVictim] += fDamage;}public fwHamKilledPlayerPre(const iIDVictim, iIDAttacker){ if ((1 <= iIDAttacker <= g_iMaxPlayers) && !bitsum_get(g_iBsConnected, iIDAttacker)) return PLUGIN_CONTINUE; if (!iIDAttacker) iIDAttacker = iIDVictim; new Float:fDamage, iIDAssister; for (new iID = 1; iID <= g_iMaxPlayers; iID++) {/* if (g_fDamage[iID][iIDVictim]) ftD7Log(_, _, "[fwHamKilledPlayerPre] iIDAttacker: ^"%s^". iIDAssister: ^"%s^". iIDVictim: ^"%s^". ^n\ g_fDamage[%s][%s]: %.2f. fDamage: %.2f.", szNameAttacker, szNameAssister, g_szName[iIDVictim], g_szName[iID], g_szName[iIDVictim], g_fDamage[iID][iIDVictim], fDamage) */ if (iID == iIDAttacker || fDamage >= g_fDamage[iID][iIDVictim]) { g_fDamage[iID][iIDVictim] = 0.0; continue; } iIDAssister = iID; fDamage = g_fDamage[iID][iIDVictim]; g_fDamage[iID][iIDVictim] = 0.0; } if (!iIDAssister) return PLUGIN_CONTINUE; new szNameAttacker[g_iSizeName], szNameAssister[g_iSizeName]; get_user_name(iIDAttacker, szNameAttacker, charsmax(szNameAttacker)) get_user_name(iIDAssister, szNameAssister, charsmax(szNameAssister)) //ftD7Log(_, _, "[fwHamKilledPlayerPre] iIDAttacker: ^"%s^". iIDVictim: %d. iIDAssister: ^"%s^".", szNameAttacker, iIDVictim, szNameAssister) static iSizeNameEqual; if (!iSizeNameEqual) { iSizeNameEqual = floatround(float(g_iSizeName - sizeof g_szNameJoiner) / 2, floatround_floor); } new iLenghtString, szNameJoined[g_iSizeName]; iLenghtString = iSizeNameEqual - strlen(szNameAssister); if (iLenghtString <= 0) iLenghtString = iSizeNameEqual; else iLenghtString += iSizeNameEqual; formatex(szNameJoined, iLenghtString - 1, szNameAttacker) iLenghtString = strlen(szNameJoined); new iPos; while ((szNameAssister[iPos] == szNameJoined[iPos] || szNameAssister[iPos] == ' ') && iPos < iLenghtString) { iPos++; } iPos -= (iSizeNameEqual + (iSizeNameEqual - iLenghtString)); if (iPos < 0) iPos = 0; formatex(szNameJoined[iLenghtString], g_iSizeName - iLenghtString - 1, "%s%s", g_szNameJoiner, szNameAssister[iPos]) //ftD7Log(_, _, "[fwHamKilledPlayerPre] iIDAttacker: ^"%s^". iIDAssister: ^"%s^". szNameJoined: ^"%s^".", szNameAttacker, szNameAssister, szNameJoined) bitsum_add(g_iBsNameRestore, iIDAttacker) message_begin(MSG_ALL, SVC_UPDATEUSERINFO) write_byte(iIDAttacker - 1) write_long(get_user_userid(iIDAttacker)) write_char('\') write_char('n') write_char('a') write_char('m') write_char('e') write_char('\') write_string(szNameJoined) for (iPos = 0; iPos < 16; iPos++) write_byte(0) message_end() return PLUGIN_CONTINUE;}// DeathMsg is triggered after fwHamKilledPlayerPre and before fwHamKilledPlayerpublic fwHamKilledPlayer(const iIDVictim, iIDAttacker){ if (bitsum_get(g_iBsNameRestore, iIDAttacker)) bitsum_del(g_iBsNameRestore, iIDAttacker) else if (bitsum_get(g_iBsNameRestore, iIDVictim)) { bitsum_del(g_iBsNameRestore, iIDVictim) iIDAttacker = iIDVictim; } else return; new szUserInfo[256] copy_infokey_buffer(engfunc(EngFunc_GetInfoKeyBuffer, iIDAttacker), szUserInfo, charsmax(szUserInfo)) message_begin(MSG_ALL, SVC_UPDATEUSERINFO) write_byte(iIDAttacker - 1) write_long(get_user_userid(iIDAttacker)) write_string(szUserInfo) write_long(0) write_long(0) write_long(0) write_long(0) message_end()} cs_ham_bots_api.sma cs_ham_bots_api.inc bitsums.inc Attached Files Get Plugin or Get Source (D7KillAssist.sma - 9.0 KB) Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi