RSSy MYGO.pl Opublikowano Marzec 21, 2020 o 14:01 RSSy Udostępnij Opublikowano Marzec 21, 2020 o 14:01 Quote: /* UTF-8 func by www.DT-Club.net */ #include <amxmodx> #include <amxmisc> #include <cstrike> #include <fakemeta> #include <colorchat> #include <knifemain> #include <hamsandwich> #define VERSION "0.2" #define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY) new g_userblast[33], g_blast[33], bool:g_chargeover[33], bool:g_oncharge[33], origins[33][3] new gMsgBarTime new gSpriteSmoke, gSpriteTrail, gSpriteExplosion, loot_spr, g_exploSpr new g_freezetime new cvar_blast_radius, cvar_blast_kbpower, cvar_round_reset //First 3 are mid size burn decals, second 3 are larger grenade size new gBurnDecal[6] = {28, 29, 30, 46, 47, 48} new gPcvarSpeed, gPcvarDecals new const gPowerClass[] = "knife_blast" new const gSoundCharge[] = "shmod/ssjgohan_kamehame.wav" new const gSoundRelease[] = "shmod/ssjgohan_ha.wav" new const gSoundBeam[] = "shmod/esf_beamhead.wav" new const gModelKamehameha[] = "sprites/shmod/esf_kamehameha_blue.spr" enum (+= 100) { TASK_CHARGE = 2001 } #define ID_CHARGE (taskid - TASK_CHARGE) public plugin_init() { // Plugin Info register_plugin("knife_blast", VERSION, "codefromSH") cvar_blast_radius = register_cvar("blast_radius", "400") cvar_blast_kbpower = register_cvar("blast_kbpower", "4.5") cvar_round_reset = register_cvar("blast_roundreset", "0") gPcvarSpeed = register_cvar("blast_powerspeed", "1000") gPcvarDecals = register_cvar("blast_decals", "1") register_cvar("loot_chance", "10") register_cvar("kb_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY) register_clcmd("+blast", "charge_blast") register_clcmd("-blast", "fire_blast") register_concmd("amx_giveb", "cmdblast", ADMIN_KICK, "<name or #userid> [reason]") register_event("CurWeapon", "curweapon", "be", "1=1") register_event("ResetHUD", "new_round", "b") register_event("HLTV", "event_round_start", "a", "1=0", "2=0") register_logevent("logevent_round_start",2, "1=Round_Start") register_forward(FM_Think, "fm_Think") register_forward(FM_Touch, "fm_Touch") RegisterHam(Ham_Spawn, "player", "ham_playerspawn", 1) RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") gMsgBarTime = get_user_msgid("BarTime") } public plugin_precache() { precache_sound(gSoundCharge) precache_sound(gSoundRelease) precache_sound(gSoundBeam) precache_model(gModelKamehameha) gSpriteTrail = precache_model("sprites/shmod/esf_trail_blue.spr") gSpriteExplosion = precache_model("sprites/shmod/esf_exp_blue.spr") gSpriteSmoke = precache_model("sprites/wall_puff4.spr") loot_spr = precache_model("sprites/loot_bag.spr") g_exploSpr = precache_model("sprites/shockwave.spr") } public event_round_start() { g_freezetime = true } public logevent_round_start() { // Freezetime ends g_freezetime = false } public cmdblast(id, level, cid) { if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED new arg[32] read_argv(1, arg, 31) new arg2[10] read_argv(2, arg2, 9) new count = str_to_num(arg2) new authid[32], authid2[32], name2[32], name[32] get_user_authid(id, authid, 31) get_user_name(id, name, 31) if (arg[0] == '@') { if (arg[1] == 'A' || arg[1] == 'a') { new players[32], num get_players(players, num) new i for (i=0; i<num; i++) { g_userblast[players] += count } ColorChat(0, TEAM_COLOR, "Admin:给所有玩家 %d个龟派气功",name, count) } } else { new player = cmd_target(id, arg, CMDTARGET_NO_BOTS) if (!player) return PLUGIN_HANDLED get_user_authid(player, authid2, 31) get_user_name(player, name2, 31) g_userblast[player] += count // client_print(0, print_chat, "Admin: %s --> %s add blast!", name, name2) ColorChat(0, TEAM_COLOR, "Admin:%s赠送 %s %d个龟派气功",name, name2, count) } return PLUGIN_HANDLED } public client_connect(id) { g_userblast[id] = 0 g_blast[id] = 0 client_cmd(id, "bind mouse3 +blast") } public client_disconnect(id) { if( g_userblast[id] && g_blast[id] > 0) remove_power(id, g_blast[id]) if(task_exists(462+id)) remove_task(462+id) if(fm_find_ent_by_owner(-1, "loot_marker", id) != 0) engfunc(EngFunc_RemoveEntity, fm_find_ent_by_owner(-1,"loot_marker",id)) } public new_round(id) { //while(fm_find_ent_by_class(-1, "loot_marker") != 0) // engfunc(EngFunc_RemoveEntity, fm_find_ent_by_class(-1,"loot_marker")) // if(task_exists(462+id)) // remove_task(462+id) } public ham_playerspawn(id) { if (!is_user_alive(id)) return; if(get_pcvar_num(cvar_round_reset)) g_userblast[id] = 0 g_chargeover[id] = false remove_task(id+TASK_CHARGE) remove_task(1982+id) remove_task(1980+id) emit_sound(id, CHAN_STATIC, gSoundCharge, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) } public fw_PlayerKilled(victim, attacker, shouldgib) { // if(is_user_connected(victim) && (random_num(1, get_cvar_num("loot_chance")) == 1)) if(is_user_connected(victim) && random_num(1, get_cvar_num("loot_chance")) == 1) { static Float:origina[3] get_user_origin(victim, origins[victim], 0) // pev(victim, pev_origin, origins[victim], 0) new parm[1] parm[0] = victim set_task(0.5,"loot_sprite",462+victim,parm,1, "b") new mark = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) set_pev(mark, pev_classname, "loot_marker") set_pev(mark, pev_solid, 1) origina[0] = float(origins[victim][0]) origina[1] = float(origins[victim][1]) origina[2] = float(origins[victim][2]) engfunc(EngFunc_SetOrigin, mark, origina) set_pev(mark, pev_scale, 0.2) set_pev(mark, pev_owner, victim) } remove_task(victim+TASK_CHARGE) progressBar(victim, 0) emit_sound(victim, CHAN_STATIC, gSoundCharge, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) } public charge_blast(id) { if(is_mode_round()) return if(!is_user_alive(id)) return if ( g_blast[id] || g_userblast[id] < 1) return engclient_cmd(id, "weapon_knife") g_oncharge[id] = true emit_sound(id, CHAN_STATIC, gSoundCharge, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) progressBar(id, 4) // set_task(4.0, "powerCharged", id) set_task(4.0, "powerCharged", id+TASK_CHARGE) new parm[2] parm[0] = id parm[1] = 12 set_task(0.3, "create_blast", 1982+id, parm, 1, "a", 15) set_task(1.0, "create_implosion", 1980+id, parm, 1, "a", 5) } public fire_blast(id) { if(is_mode_round()) return if ( !g_chargeover[id] || !is_user_alive(id) ) { remove_task(id) remove_task(id+TASK_CHARGE) remove_task(1982+id) remove_task(1980+id) emit_sound(id, CHAN_STATIC, gSoundCharge, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) progressBar(id, 0) if(g_oncharge[id]) engclient_cmd(id, "lastinv") g_oncharge[id] = false return } if ( !is_user_alive(id) && g_freezetime) return remove_task(1982+id) remove_task(1980+id) emit_sound(id, CHAN_STATIC, gSoundCharge, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) emit_sound(id, CHAN_STATIC, gSoundRelease, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) progressBar(id, 0) g_chargeover[id] = false g_oncharge[id] = false create_kamehame(id) client_print(id, print_center, "龟派气功还剩: %d", g_userblast[id]) remove_task(id+TASK_CHARGE) } public powerCharged(taskid) { if(is_user_alive(ID_CHARGE)) g_chargeover[ID_CHARGE] = true remove_task(taskid) } progressBar(id, seconds) { message_begin(MSG_ONE_UNRELIABLE, gMsgBarTime, _, id) write_byte(seconds) write_byte(0) message_end() } create_kamehame(id) { new newEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) if ( !newEnt ) return g_userblast[id]-- g_blast[id] = newEnt set_pev(newEnt, pev_classname, gPowerClass) engfunc(EngFunc_SetModel, newEnt, gModelKamehameha) engfunc(EngFunc_SetSize, newEnt, {-2.0, -2.0, -2.0}, {2.0, 2.0, 2.0}) new Float:fl_Origin[3], Float:fl_Angles[3], Float:fl_vAngle[3] pev(id, pev_origin, fl_Origin) pev(id, pev_angles, fl_Angles) pev(id, pev_v_angle, fl_vAngle) fl_Origin[2] += 6.0 engfunc(EngFunc_SetOrigin, newEnt, fl_Origin) set_pev(newEnt, pev_angles, fl_Angles) set_pev(newEnt, pev_v_angle, fl_vAngle) set_pev(newEnt, pev_solid, SOLID_BBOX) set_pev(newEnt, pev_movetype, MOVETYPE_FLY) //set_pev(newent,pev_movetype,MOVETYPE_TOSS) //set_pev(newEnt,pev_movetype,MOVETYPE_TOSS) set_pev(newEnt, pev_rendermode, kRenderTransAdd) set_pev(newEnt, pev_renderamt, 255.0) set_pev(newEnt, pev_scale, 1.20) set_pev(newEnt, pev_owner, id) new Float:fl_Velocity[3], AimVec[3], Float:fl_EndOrigin[3] get_user_origin(id, AimVec, 3) IVecFVec(AimVec, fl_EndOrigin) sh_get_velocity(fl_Origin, fl_EndOrigin, get_pcvar_float(gPcvarSpeed), fl_Velocity) set_pev(newEnt, pev_velocity, fl_Velocity) emit_sound(newEnt, CHAN_STATIC, gSoundBeam, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BEAMFOLLOW) write_short(newEnt) // entity:attachment to follow write_short(gSpriteTrail) // sprite index write_byte(100) // life in 0.1's write_byte(8) // line width in 0.1's write_byte(255) // r,g,b write_byte(255) write_byte(255) write_byte(255) // brightness message_end() new Float:gametime global_get(glb_time, gametime) set_pev(newEnt, pev_nextthink, gametime + 0.1) } public fm_Think(ent) { if ( !pev_valid(ent) ) return FMRES_IGNORED static classname[32] classname[0] = '^0' pev(ent, pev_classname, classname, 31) if ( !equal(classname, gPowerClass) ) return FMRES_IGNORED new id = pev(ent, pev_owner) if ( !is_user_connected(id) ) { fm_Touch(ent, 0) return FMRES_IGNORED } new Float:fl_Origin[3], AimVec[3], Float:fl_EndOrigin[3], Float:fl_Velocity[3], Float:fl_OldVelocity[3] new avgFactor new Float:speed = get_pcvar_float(gPcvarSpeed) get_user_origin(id, AimVec, 3) IVecFVec(AimVec, fl_EndOrigin) pev(ent, pev_origin, fl_Origin) if ( speed < 1000.0 ) avgFactor = 6 else if ( speed < 1500.0 ) avgFactor = 4 else avgFactor = 2 sh_get_velocity(fl_Origin, fl_EndOrigin, speed, fl_Velocity) pev(ent, pev_velocity, fl_OldVelocity) new oneless = avgFactor-1 fl_Velocity[0] += fl_OldVelocity[0] * oneless fl_Velocity[1] += fl_OldVelocity[1] * oneless fl_Velocity[2] += fl_OldVelocity[2] * oneless fl_Velocity[0] /= avgFactor fl_Velocity[1] /= avgFactor fl_Velocity[2] /= avgFactor //set_pev(ent, pev_movetype, MOVETYPE_FLY)//修改 set_pev(ent, pev_velocity, fl_Velocity) new Float:gametime global_get(glb_time, gametime) set_pev(ent, pev_nextthink, gametime + 0.1) return FMRES_IGNORED } public fm_Touch(ptr, ptd) { if (!pev_valid(ptr)) return FMRES_IGNORED static classname[32], classname2[32] pev(ptr, pev_classname, classname, 31) if ( equal(classname, gPowerClass) ) { static Float:fl_vExplodeAt[3], id id = pev(ptr, pev_owner) pev(ptr, pev_origin, fl_vExplodeAt) blast_knockback(id, fl_vExplodeAt, get_pcvar_float(cvar_blast_radius), get_pcvar_float(cvar_blast_kbpower)) new blastSize = floatround(get_pcvar_float(cvar_blast_radius) / 12.0) // Explosion Sprite message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_GLOWSPRITE) //23 engfunc(EngFunc_WriteCoord, fl_vExplodeAt[0]) engfunc(EngFunc_WriteCoord, fl_vExplodeAt[1]) engfunc(EngFunc_WriteCoord, fl_vExplodeAt[2]) write_short(gSpriteExplosion) // model write_byte(01) // life 0.x sec write_byte(blastSize) // size write_byte(255) // brightness message_end() // Explosion (smoke, sound/effects) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_EXPLOSION) //3 engfunc(EngFunc_WriteCoord, fl_vExplodeAt[0]) engfunc(EngFunc_WriteCoord, fl_vExplodeAt[1]) engfunc(EngFunc_WriteCoord, fl_vExplodeAt[2]) write_short(gSpriteSmoke) // model write_byte(blastSize+5) // scale in 0.1's write_byte(20) // framerate write_byte(10) // flags message_end() // Create Burn Decals, if they are used if ( get_pcvar_num(gPcvarDecals) ) { // Change burn decal according to blast size new decal = random_num(0,2) if (blastSize > 18) { //If radius >~ 216 use larger decals decal += 3 } message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_GUNSHOTDECAL) //109 engfunc(EngFunc_WriteCoord, fl_vExplodeAt[0]) engfunc(EngFunc_WriteCoord, fl_vExplodeAt[1]) engfunc(EngFunc_WriteCoord, fl_vExplodeAt[2]) write_short(0) //? write_byte(gBurnDecal[decal]) //decal message_end() } emit_sound(ptr, CHAN_STATIC, gSoundBeam, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) emit_sound(id, CHAN_STATIC, gSoundRelease, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) engfunc(EngFunc_RemoveEntity, ptr) // Reset the Varible g_blast[id] = 0 // Switch back to previous weapon and reset speed... engclient_cmd(id, "lastinv") } if(!is_user_connected(ptd)) return FMRES_IGNORED pev(ptd, pev_classname, classname2, 31) if (equal(classname, "loot_marker")) { if(equal(classname2,"player")) { new id = pev(ptr, pev_owner) if(is_user_alive(ptd)) { if(fm_find_ent_by_owner(-1, "loot_marker", id)!=0) engfunc(EngFunc_RemoveEntity, fm_find_ent_by_owner(-1, "loot_marker" , id)) remove_task(462+id) g_userblast[ptd]++ static name[32], name2[32] get_user_name(id, name, 31) get_user_name(ptd, name2, 31) ColorChat(0, NORMAL, "^x04%s 获得龟派气功",name2, name, g_userblast[ptd]) } } } return FMRES_IGNORED } //---------------------------------------------------------------------------------------------- public remove_power(id, powerID) { new Float:fl_vOrigin[3] pev(powerID, pev_origin, fl_vOrigin) // Create an effect of kamehameha being removed message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_IMPLOSION) //14 engfunc(EngFunc_WriteCoord, fl_vOrigin[0]) engfunc(EngFunc_WriteCoord, fl_vOrigin[1]) engfunc(EngFunc_WriteCoord, fl_vOrigin[2]) write_byte(120) // radius write_byte(40) // count write_byte(45) // life in 0.1's message_end() emit_sound(powerID, CHAN_STATIC, gSoundBeam, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) emit_sound(id, CHAN_STATIC, gSoundRelease, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM) engfunc(EngFunc_RemoveEntity, powerID) if ( is_user_connected(id) ) engclient_cmd(id, "lastinv") } public curweapon(id) { if ( !is_user_alive(id) || !g_userblast[id]) return PLUGIN_CONTINUE if ( read_data(2) != CSW_KNIFE && g_oncharge[id]) engclient_cmd(id, "weapon_knife") return PLUGIN_CONTINUE } public loot_sprite(parm[]) { //TE_SPRITE message_begin(MSG_ALL,SVC_TEMPENTITY) write_byte(17) // additive sprite, plays 1 cycle write_coord(origins[parm[0]][0]) // pos write_coord(origins[parm[0]][1]) // pos write_coord(origins[parm[0]][2]) // pos write_short (loot_spr) // spr index write_byte(2) // (scale in 0.1's) write_byte (1000) //(brightness) message_end() // remove_task(462+parm[0]) } public create_blast(parm[]) { new id = parm[0] if ( !is_user_alive(id) ) return new Iori[3] get_user_origin(id, Iori) message_begin(MSG_PVS, SVC_TEMPENTITY, Iori, 0) write_byte(21) write_coord(Iori[0]) write_coord(Iori[1]) write_coord(Iori[2]-26) write_coord(Iori[0]) write_coord(Iori[1]) write_coord(Iori[2]+555) write_short(g_exploSpr) // sprite write_byte(0) // startframe write_byte(0) // framerate write_byte(4) // life write_byte(7) // width write_byte(0) // noise write_byte(random(255)) // red write_byte(random(255)) // green write_byte(random(255)) // blue write_byte(100) // brightness write_byte(0) // speed message_end(); } public create_implosion(parm[]) { new id = parm[0] if ( !is_user_alive(id) ) return new Iori[3] get_user_origin(id, Iori) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_IMPLOSION) write_coord(Iori[0]) write_coord(Iori[1]) write_coord(Iori[2]) write_byte(180) write_byte(64) write_byte(8) message_end(); } stock sh_get_velocity(const Float:initial[3], const Float:final[3], Float:speed, Float:velocity[3]) { // Lets make sure we are within range static sv_maxvelocity; if ( !sv_maxvelocity ) { sv_maxvelocity = get_cvar_pointer("sv_maxvelocity"); } static Float:maxSpeed; maxSpeed = get_pcvar_float(sv_maxvelocity); // Time = Distance / Speed new Float:fTime = vector_distance(initial, final) / floatclamp(speed, -maxSpeed, maxSpeed); // Velocity = Distance / Time velocity[0] += (final[0] - initial[0]) / fTime; velocity[1] += (final[1] - initial[1]) / fTime; velocity[2] += (final[2] - initial[2]) / fTime; } stock blast_knockback(ent, Float:hitPointOrigin[3], Float:radius, Float:power) { new Float:entOrigin[3] new Float:velocity[3] new Float:cOrigin[3] static victim victim = -1 while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, hitPointOrigin, radius)) != 0) { if (!is_user_alive(victim)) continue; pev(victim, pev_origin, entOrigin) new Float:distanceNadePl = vector_distance(entOrigin, hitPointOrigin) // Stuff on ground AND below explosion are "placed" a distance above explosion Y-wise ([2]), so that they fly if (entity_is_on_ground(victim) && entOrigin[2] < hitPointOrigin[2]) entOrigin[2] = hitPointOrigin[2] + distanceNadePl pev(victim, pev_velocity, velocity) cOrigin[0] = (entOrigin[0] - hitPointOrigin[0]) * radius / distanceNadePl + hitPointOrigin[0] cOrigin[1] = (entOrigin[1] - hitPointOrigin[1]) * radius / distanceNadePl + hitPointOrigin[1] cOrigin[2] = (entOrigin[2] - hitPointOrigin[2]) * radius / distanceNadePl + hitPointOrigin[2] velocity[0] += (cOrigin[0] - entOrigin[0]) * power velocity[1] += (cOrigin[1] - entOrigin[1]) * power velocity[2] += (cOrigin[2] - entOrigin[2]) * power message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim) write_byte(1) // damage save write_byte(1) // damage take write_long(DMG_GENERIC) // damage type write_coord(0) // x write_coord(0) // y write_coord(0) // z message_end() get_user_killer(victim, ent) set_pev(victim, pev_velocity, velocity) } } stock fm_find_ent_by_owner(entity, const classname[], owner) { while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) { /* keep looping */ } return entity; } stock fm_find_ent_by_class(index, const classname[]) return engfunc(EngFunc_FindEntityByString, index, "classname", classname) public entity_is_on_ground(entity) return pev(entity, pev_flags) & FL_ONGROUND Attached Files knifemain.inc (238 Bytes) Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi