Van ez a satchnel c4 bomba vagy nemtudom miaz. De alapbol HE-granatra van irva ami bugol. En atirtam C4-re de itt az a baj hogy amikor akarom elesiteni akkor kiirja hogy "Only plane mittom mit de "kikene venni a bugot hogy mindenhol lehessen tenni bombat.
Kód: /* Copyright © 2009, NiHiLaNTh
Satchel Charge plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Satchel Charge plugin; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --- Intro --- Satchel Charges from HL, which replaces he grenade To plant a charge press secondary attack button.To detonate a charge press primary attack button.By default Satchel cost is 15 Ammo packs --- CVARs --- zp_satchel_damage -- 100 // maxdamage zp_satchel_oneround -- 0 // If set to 1 all player will stripped from Satchel Charge; else ignored zp_satchel_radius -- 300 // damage radius zp_satchel_knockback --- 10 // knockback power --- Changelog: --- v3.0 - First release v3.1 - Now satchel lays on the ground and fixed bug with radius v3.2 - Fixed bugs when satchel did not dissappear v3.3 - Full code rewrite and many major and minor chages, fixed a lot of issues' v3.4 - Coded this plugin in much better way - Fixed bunch of gameplayer bugs --- Credits --- V3x - his Satchel Charge plugin NiHiLaNTh - Author Arkshine - Animation stock meTaLiCroSS - Weapon model reset stuff If you find any bug - report it on plugin thread, which can be found here http://forums.alliedmods.net/showthread.php?t=96755
*/
#include <amxmodx> #include <cstrike> #include <engine> #include <fakemeta> #include <fun> #include <hamsandwich> #include <zombieplague>
// Plugin stuff new const PLUGIN[] = "[ZP] Extra Item: Satchel Charge" new const VERSION[] = "3.4" new const AUTHOR[] = "NiHiLaNTh"
// Satchel and satchel radio models new const p_satchel[] = "models/p_satchel.mdl" new const v_satchel[] = "models/v_satchel.mdl" new const w_satchel[] = "models/w_satchel.mdl" new const w_satchelT[] = "models/w_satchelt.mdl" new const p_satchel_radio[] = "models/p_satchel_radio.mdl" new const v_satchel_radio[] = "models/v_satchel_radio.mdl"
// Sprite new const explode_sprite[] = "sprites/zerogxplode.spr" new const smoke_sprite[] = "sprites/steam1.spr"
// Item cost #define COST 15
// Cached sprite indexes new g_exploSpr, g_smokeSpr
// Message ID new g_msgScoreInfo
// CVAR Pointers new cvar_dmg, cvar_oneround, cvar_radius, cvar_knockback
// Item ID new g_satchel
// Player variables new g_hasRadio[33] // has detonator new g_hasSatchel[33] // has S.Charge new g_hasPlanted[33] // has planted the bomb new g_CanPlant[33] // I had to do it new g_CurrentWeapon[33] // Current weapon player is holding
// Game variables new g_maxplayers new g_restarted
// Animations // Satchel enum { satchel_idle1 = 0, satchel_fidget1, satchel_draw, satchel_drop }
// Satchel Radio enum { radio_idle1 = 0, radio_fidget1, radio_draw, radio_fire, radio_holster }
// Chat messages(Translate here) new const NOTICE_USE1[] = { "[ZP] You got satchel charge.Press attack key to plant them." }, NOTICE_USE2[] = { "[ZP] Press secondary attack button to detonate Satchel." }, NOTICE_YOUPLANT[] = { "You already planted the bomb" }, NOTICE_PLANT[] = { "You planted a Satchel Charge" }, NOTICE_HAVE[] = { "Already have Satchel Charge" }, NOTICE_PLANT1[] = { "Cannot drop, because you planted Satchel" } // Plugin precache public plugin_precache() { // Precache models... precache_model(p_satchel) precache_model(v_satchel) precache_model(w_satchel) precache_model(w_satchelT) precache_model(p_satchel_radio) precache_model(v_satchel_radio) // and sprites g_exploSpr = precache_model(explode_sprite) g_smokeSpr = precache_model(smoke_sprite) }
// Plugin initialization public plugin_init() { // Register my new plugin register_plugin(PLUGIN, VERSION, AUTHOR) register_cvar("zp_satchel_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY) // Register new extra item g_satchel = zp_register_extra_item("Satchel Charge", COST, ZP_TEAM_HUMAN) // Client command register_clcmd("drop", "clcmd_drop") // Events register_event("CurWeapon", "Event_CurrentWeapon", "b", "1=1") register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0"); register_event("TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in"); // Log Event register_logevent("LogEvent_RoundEnd", 2, "1=Round_End") // Forwards register_forward(FM_CmdStart, "fw_CmdStart") RegisterHam(Ham_Item_Deploy, "weapon_hegrenade", "fw_SatchelDeploy", 1) RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_RadioDeploy", 1) //register_forward(FM_Touch, "fw_Touch") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") // Register cvars cvar_dmg = register_cvar("zp_satchel_dmg", "1000") cvar_oneround = register_cvar("zp_satchel_oneround", "0") cvar_radius = register_cvar("zp_satchel_radius", "300") cvar_knockback = register_cvar("zp_satchel_knockback", "10") // Messages g_msgScoreInfo = get_user_msgid("ScoreInfo")
// Touch register_touch("drop_satchel", "player", "satchel_touch") // Store maxplayers in a global variable g_maxplayers = get_maxplayers() }
// Client connected public client_connect(id) { // Don't have satchel g_hasSatchel[id] = false g_hasRadio[id] = false g_hasPlanted[id] = false g_CanPlant[id] = false }
// Drop command public clcmd_drop(id) { // Has Satchel if (g_hasSatchel[id] && g_CurrentWeapon[id] == CSW_C4) { // Drop it drop_satchel(id) // Fix touch_fix(id) // Force to loose HE grenade ham_strip_weapon(id, "weapon_hegrenade") // Reset knife model reset_user_knife(id) // Reset vars g_hasSatchel[id] = false g_hasPlanted[id] = false g_hasRadio[id] = false g_CanPlant[id] = false } // Player planted Satchel - can't drop if (g_hasPlanted[id] && g_CurrentWeapon[id] == CSW_KNIFE) { client_print(id, print_chat, "%s", NOTICE_PLANT1) return PLUGIN_HANDLED } return PLUGIN_CONTINUE }
// Buy some extra items public zp_extra_item_selected(id, itemid) { // Our extra item if (itemid == g_satchel) { // Already own Satchel if (g_hasSatchel[id] || g_hasPlanted[id]) { // Warn client_print(id, print_center, "%s", NOTICE_HAVE) return ZP_PLUGIN_HANDLED } else { // Notices client_print(id, print_chat, "%s", NOTICE_USE1) client_print(id, print_chat, "%s", NOTICE_USE2) // Reset vars g_hasSatchel[id] = true g_hasPlanted[id] = false g_hasRadio[id] = true g_CanPlant[id] = true // Give him hegrenade give_item(id, "weapon_hegrenade") // Force to he grenade engclient_cmd(id, "weapon_hegrenade") // Change weapon models ChangeModelsSatchel(id) // Play animation UTIL_PlayWeaponAnimation(id, satchel_draw) } } return PLUGIN_CONTINUE } // Someone has been injected public zp_user_infected_post(id, infector) { // Have Satchel if (g_hasSatchel[id] || g_hasPlanted[id]) { // Reset vars g_hasSatchel[id] = false g_hasRadio[id] = false g_hasPlanted[id] = false g_CanPlant[id] = false // Drop it drop_satchel(id) /************DONT TOUCH IT OR SERVER WILL CRASH ON RESTART***********/ // Update Score //UpdateScore(infector, id, 0, 0, 1) // Fix touch_fix(id) // Reset knife model reset_user_knife(id) // Remove planted satchel remove_planted_satchel() } }
// Current weapon public Event_CurrentWeapon(id) { // Dead if (!is_user_alive(id)) return PLUGIN_CONTINUE // Update array g_CurrentWeapon[id] = read_data(2) return PLUGIN_CONTINUE }
// New round public Event_NewRound() { if (g_restarted) { // Make a loop for (new i = 1; i <= get_maxplayers(); i++) { // Strip from Satchel if (g_hasSatchel[i] || g_hasPlanted[i]) { // Reset vars g_hasSatchel[i] = false g_hasRadio[i] = false g_CanPlant[i] = false g_hasPlanted[i] = false } } g_restarted = false } }
// Restart event public Event_GameRestart() { g_restarted = true }
public LogEvent_RoundEnd() { // One round only cvar enabled if (get_pcvar_num(cvar_oneround) == 1) { // Loop for (new i = 1; i < g_maxplayers; i++) { // Reset vars g_hasSatchel[i] = false g_hasPlanted[i] = false g_hasRadio[i] = false g_CanPlant[i] = false } } // Remove dropped satchels remove_dropped_satchel() // Remove planted satchel remove_planted_satchel() }
// Command start public fw_CmdStart(id, uc_handle, seed) { // Dead/Zombie/Nemesis if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id)) return FMRES_IGNORED
// Get weapon and player buttons new weapon = get_user_weapon(id) new buttons = get_uc(uc_handle, UC_Buttons) // HE grenade(Satchel) if (weapon == CSW_C4) { // Secondary attack if (buttons & IN_ATTACK2) { // Already planted if (g_hasPlanted[id]) { // Wanr client_print(id, print_center, "%s", NOTICE_YOUPLANT) return FMRES_IGNORED } // Can plant else if (g_hasSatchel[id]) { // Plant satchel plant_satchel(id) } } } // Knife(Radio) else if (weapon == CSW_KNIFE) { // Primary attck if (buttons & IN_ATTACK) { // Have planted or have radio if (g_hasPlanted[id] || g_hasRadio[id]) { // Play animation UTIL_PlayWeaponAnimation(id, radio_fire) // Detonate it detonate_satchel(id) } } } return FMRES_IGNORED }
// Satchel deploy public fw_SatchelDeploy(iEnt) { // Get id new id = get_pdata_cbase(iEnt, 41, 5)
// have satchel if (g_hasSatchel[id]) { // Change models ChangeModelsSatchel(id) // Play animation UTIL_PlayWeaponAnimation(id, satchel_draw) // Modify time until next primary attack set_pdata_float(iEnt, 46, 9999.0, 4); // Modify time until next attack set_pdata_float(id, 83, 9999.0); } }
// Radio deploy public fw_RadioDeploy(iEnt) { // Get id new id = get_pdata_cbase(iEnt, 41, 5)
// have satchel if (g_hasPlanted[id] || g_hasRadio[id] ) { // Change radio models ChangeModelsRadio(id) // Play animation UTIL_PlayWeaponAnimation(id, radio_draw) // Modify time until next primary attack set_pdata_float(iEnt, 46, 9999.0, 4); // Modify time until next attack set_pdata_float(id, 83, 9999.0); } }
// Player killed public fw_PlayerKilled(victim, attacker, shouldgib) { // Have satchel if (g_hasSatchel[victim] || g_hasPlanted[victim]) { // Reset vars g_hasSatchel[victim] = false g_hasPlanted[victim] = false g_CanPlant[victim] = false g_hasRadio[victim] = false // Drop satchel drop_satchel(victim) // Fix touch_fix(victim) // Remove planted satchel remove_planted_satchel() } }
// Plant satchel public plant_satchel(id) { // Zombie/Nemesis/Dead if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !is_user_alive(id)) return PLUGIN_CONTINUE // Now all is OK set_task(0.1 ,"CreateBomb", id, _, _, _) // Strip from hegrenade ham_strip_weapon(id, "weapon_hegrenade") // Change models ChangeModelsRadio(id) // Switch to knife engclient_cmd(id, "weapon_knife") // Reset stuff g_hasPlanted[id] = true g_hasRadio[id] = true g_hasSatchel[id] = false g_CanPlant[id] = false return PLUGIN_CONTINUE }
// Create bomb public CreateBomb(id) { // Play animation UTIL_PlayWeaponAnimation(id, satchel_drop) // Create entity new iBomb = create_entity("info_target") if(iBomb == 0) return PLUGIN_HANDLED // Set it's classname entity_set_string(iBomb, EV_SZ_classname, "remote_bomb") // Set it's model entity_set_model(iBomb, w_satchel) // Set it's size entity_set_size(iBomb, Float:{-2.0,-2.0,-1.0}, Float:{2.0,2.0,1.0}) entity_set_int(iBomb, EV_INT_movetype, MOVETYPE_TOSS) entity_set_int(iBomb, EV_INT_solid, SOLID_TRIGGER) // Set it's gravity entity_set_float(iBomb, EV_FL_gravity, 0.9) // Drop it to flooe engfunc(EngFunc_DropToFloor, iBomb) // Get origin and vector new Float:iOrigin[3] entity_get_vector(id, EV_VEC_origin, iOrigin) //iOrigin[1] += 50 // Set angle new Float:angles[3] angles[0] += 180 angles[1] += 90 angles[2] += 90 entity_set_vector(iBomb, EV_VEC_angles, angles) // Set origin and angles entity_set_origin(iBomb, iOrigin) // Get owner entity_set_int(iBomb, EV_ENT_owner, id) // Notice player client_print(id, print_center ,"%s", NOTICE_PLANT) // Play sound emit_sound(id, CHAN_WEAPON, "weapons/c4_plant.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) // Next think entity_set_float(iBomb, EV_FL_nextthink, halflife_time() + 0.01) // Reset //g_hasPlanted[id] = true //g_hasRadio[id] = true //g_CanPlant[id] = false //g_hasSatchel[id] = false return PLUGIN_HANDLED }
// Detonate satchel public detonate_satchel(id) { // Zombie/Nemesis/Dead if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !is_user_alive(id)) return PLUGIN_CONTINUE // Have planted if (g_hasPlanted[id]) { // Find ent new ent = find_ent_by_class(id, "remote_bomb") if (ent) { // Create explosion CreateExplosion(ent) // Remove ent remove_entity(ent) // Force switch to knife engclient_cmd(id, "weapon_knife") // Reset knife model reset_user_knife(id) // Reset vars g_hasPlanted[id] = false g_hasRadio[id] = false g_hasSatchel[id] = false g_CanPlant[id] = false } } return PLUGIN_CONTINUE }
// Create explosion public CreateExplosion(ent) { // Invalid entity if (!pev_valid(ent)) return // Get it's origin new Float:origin[3];pev(ent, pev_origin, origin) // Explosion message_begin(MSG_BROADCAST,SVC_TEMPENTITY) write_byte (TE_EXPLOSION) // TE ID engfunc(EngFunc_WriteCoord, origin[0]) // Position X engfunc(EngFunc_WriteCoord, origin[1]) // Y engfunc(EngFunc_WriteCoord, origin[2] + 30.0) // Z write_short(g_exploSpr) // Sprite index write_byte(30) // Scale write_byte(15) // Framerate write_byte(0) // Explosion Flag:None message_end() // Smoke message_begin(MSG_BROADCAST,SVC_TEMPENTITY) write_byte (TE_SMOKE) // TE ID engfunc(EngFunc_WriteCoord, origin[0]) // Position X engfunc(EngFunc_WriteCoord, origin[1]) // Y engfunc(EngFunc_WriteCoord, origin[2] + 50.0) // Z write_short(g_smokeSpr) // Sprite index write_byte(100) // Scale write_byte(15) // Framerate message_end() // Owner new owner = entity_get_int(ent, EV_ENT_owner) // Make a loop for (new i = 1; i < g_maxplayers; i++) { // Classname new szClassName[32] entity_get_string(i, EV_SZ_classname, szClassName, 32) // Player if (equal(szClassName, "player")) { // Alive/Don't have godmode if (is_user_alive(i) == 1 && get_user_godmode(i) == 0 ) { // Zombie/Nemesis if (zp_get_user_zombie(i) || zp_get_user_nemesis(i)) { // Get origina and distance new Float:VictimOrigin[3], Float:distance_f, distance pev(i, pev_origin, VictimOrigin) distance_f = get_distance_f(origin, VictimOrigin) distance = floatround(distance_f) if (distance < get_pcvar_num(cvar_radius)) { // Fake damage fakedamage(i, "grenade", 0.0, DMG_BLAST) // Get health/dmg/damage ratio new Float:dratio, damage dratio = floatdiv(float(distance),float(get_pcvar_num(cvar_radius))) damage = get_pcvar_num(cvar_dmg) - floatround(floatmul(float(get_pcvar_num(cvar_dmg)), dratio)) new health = get_user_health(i) // Make some knockback new Float:knockback = get_pcvar_float(cvar_knockback) make_knockback(i, origin, knockback*damage) if (health - damage >= 1) { // New health set_user_health(i, health - damage) // Create blood //ShowSomeBlood(VictimOrigin) //client_print(owner, print_chat, "===>DAMADE %d<===", damage) } else { // Log this log_kill(owner, i, "grenade", 0) // Set ammo packs zp_set_user_ammo_packs(owner, zp_get_user_ammo_packs(owner) + 1) } } } // Remove ent set_pev(ent, pev_flags, FL_KILLME) } } } }
// Remove planted satchels public remove_planted_satchel() { // Find new ent = find_ent_by_class(-1, "remote_bomb") // And remove if (ent) { engfunc(EngFunc_RemoveEntity, ent) } } // Remove dropped public remove_dropped_satchel() { // Find new ent = find_ent_by_class(-1, "drop_satchel") // And remove if (ent) { engfunc(EngFunc_RemoveEntity, ent) } }
// Drop satchel ent public drop_satchel(id) { // Get aimvec and origin static Float:flAim[3], Float:flOrigin[3] VelocityByAim(id, 64, flAim) entity_get_vector(id, EV_VEC_origin, flOrigin) // Change them a bit flOrigin[0] += flAim[0] flOrigin[1] += flAim[1] // New ent new iEnt = create_entity("info_target") // Classname entity_set_string(iEnt, EV_SZ_classname, "drop_satchel") // Origin entity_set_origin(iEnt, flOrigin) // Model entity_set_model(iEnt, w_satchel) // Size new Float:mins[3] = {-1.0, -1.0, -1.0} new Float:maxs[3] = {1.0, 1.0, 1.0} entity_set_vector(iEnt, EV_VEC_mins, mins) entity_set_vector(iEnt, EV_VEC_maxs, maxs) // Interaction entity_set_int(iEnt, EV_INT_solid, SOLID_TRIGGER) // Movetype entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_TOSS) // Strip from HE Grenade ham_strip_weapon(id, "weapon_hegrenade") // Reset vars g_hasSatchel[id] = false g_hasPlanted[id] = false g_CanPlant[id] = false g_hasRadio[id] = false }
// Someone touched dropped satchel public satchel_touch(stchl, ent) { // Prevent invalid ent messages if (!is_valid_ent(stchl) || !is_valid_ent(ent)) return PLUGIN_CONTINUE // Not allowed to touch if (zp_get_user_zombie(ent) || zp_get_user_nemesis(ent) || g_hasSatchel[ent] || g_hasRadio[ent]) return PLUGIN_CONTINUE // Reset vars g_hasSatchel[ent] = true g_hasRadio[ent] = true g_hasPlanted[ent] = false g_CanPlant[ent] = true // Give awp give_item(ent, "weapon_hegrenade") // Switch to he grenade client_cmd(ent, "weapon_hegrenade") // Change models ChangeModelsSatchel(ent) // Remove crossbow on ground remove_entity(stchl) return PLUGIN_CONTINUE }
// Satchel Models stock ChangeModelsSatchel(id) { set_pev(id, pev_viewmodel2, v_satchel) set_pev(id, pev_weaponmodel2, p_satchel) }
// Radio models stock ChangeModelsRadio(id) { set_pev(id, pev_viewmodel2, v_satchel_radio) set_pev(id, pev_weaponmodel2, p_satchel_radio) }
// Play animation(Arkshine) stock UTIL_PlayWeaponAnimation(const Player, const Sequence) { set_pev(Player, pev_weaponanim, Sequence); message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player); write_byte(Sequence); write_byte(pev(Player, pev_body)); message_end(); }
// Log kill stock log_kill(killer, victim, weapon[],headshot) { set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET) ExecuteHamB(Ham_Killed, victim, killer, 2) set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT) message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0) write_byte(killer) write_byte(victim) write_byte(headshot) write_string(weapon) message_end() new kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10] get_user_name(killer, kname, 31) get_user_team(killer, kteam, 9) get_user_authid(killer, kauthid, 31) get_user_name(victim, vname, 31) get_user_team(victim, vteam, 9) get_user_authid(victim, vauthid, 31) log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"", kname, get_user_userid(killer), kauthid, kteam, vname, get_user_userid(victim), vauthid, vteam, weapon) UpdateScore(killer, victim, 0,0, 1) return PLUGIN_CONTINUE }
// Update score stock UpdateScore(attacker, victim, frags, deaths, scoreboard) { set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags)) cs_set_user_deaths(victim, cs_get_user_deaths(victim) + deaths) if (scoreboard) { message_begin(MSG_BROADCAST, g_msgScoreInfo) write_byte(attacker) // id write_short(pev(attacker, pev_frags)) // frags write_short(cs_get_user_deaths(attacker)) // deaths write_short(0) // class? write_short(get_user_team(attacker)) // team message_end() message_begin(MSG_BROADCAST, g_msgScoreInfo) write_byte(victim) // id write_short(pev(victim, pev_frags)) // frags write_short(cs_get_user_deaths(victim)) // deaths write_short(0) // class? write_short(get_user_team(victim)) // team message_end() } }
// touch fix public touch_fix(id) { if (g_hasSatchel[id]) { g_hasSatchel[id] = false g_hasRadio[id] = false g_hasPlanted[id] = false g_CanPlant[id] = false } }
// Ham strip weapon stock ham_strip_weapon(id, weapon[]) { if(!equal(weapon,"weapon_",7)) return 0 new wId = get_weaponid(weapon) if(!wId) return 0 new wEnt while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {} if(!wEnt) return 0 if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt); if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0 ExecuteHamB(Ham_Item_Kill, wEnt) entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<wId))
return 1 } // Reset knife model stock reset_user_knife(id) { // Execute weapon Deploy if(user_has_weapon(id, CSW_KNIFE)) ExecuteHamB(Ham_Item_Deploy, find_ent_by_owner(-1, "weapon_knife", id)) // Updating Model engclient_cmd(id, "weapon_knife") emessage_begin(MSG_ONE, get_user_msgid("CurWeapon"), _, id) ewrite_byte(1) // active ewrite_byte(CSW_KNIFE) // weapon ewrite_byte(-1) // clip emessage_end() }
// Make knockback stock make_knockback(victim, Float:origin[3], Float:maxspeed) { // Get and set velocity new Float:fVelocity[3]; kickback(victim, origin, maxspeed, fVelocity) entity_set_vector(victim, EV_VEC_velocity, fVelocity);
return (1); }
// Extra calulation for knockback stock kickback(ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3]) { // Find origin new Float:fEntOrigin[3]; entity_get_vector( ent, EV_VEC_origin, fEntOrigin );
// Do some calculations new Float:fDistance[3]; fDistance[0] = fEntOrigin[0] - fOrigin[0]; fDistance[1] = fEntOrigin[1] - fOrigin[1]; fDistance[2] = fEntOrigin[2] - fOrigin[2]; new Float:fTime = (vector_distance( fEntOrigin,fOrigin ) / fSpeed); fVelocity[0] = fDistance[0] / fTime; fVelocity[1] = fDistance[1] / fTime; fVelocity[2] = fDistance[2] / fTime;
return (fVelocity[0] && fVelocity[1] && fVelocity[2]); }
Ha valaki kitudja koszonom Nekem ez mar bonyorult.
|