Junior Member
Join Date: Jul 2010
Location: Thailand
|
04-21-2011
, 09:10
Re: Realism for Paintball Gun & Mod
|
#475
|
what FFA ??
i have old version paintball v1.1
PHP Code:
#include <amxmodx> #include <fakemeta> #include <cstrike> #define PLUGIN "Paintball Gun" #define VERSION "1.1" #define AUTHOR "WhooKid" new Float:lastshot[33],g_ballsnum,Score; new onoff,color,shots,veloc,speed,blife,sound; public plugin_init() { register_plugin(PLUGIN,VERSION,AUTHOR); register_cvar("paintballgun",VERSION,FCVAR_SERVER|FCVAR_UNLOGGED); server_print("*** %s v%s by %s Enabled ***",PLUGIN,VERSION,AUTHOR); register_event("CurWeapon", "ev_curweapon", "be"); register_forward(FM_UpdateClientData,"fw_updateclientdata",1) register_logevent("new_round",2,"0=World triggered","1=Round_Start"); register_clcmd("say /ent","ent_info",ADMIN_SLAY); onoff = register_cvar("amx_pbgun","1"); color = register_cvar("pbgun_color","1"); shots = register_cvar("pbgun_shots","220"); veloc = register_cvar("pbgun_velocity","2000"); speed = register_cvar("pbgun_speed","0.08"); blife = register_cvar("pbgun_life","10"); sound = register_cvar("pbgun_sound","1"); Score = get_user_msgid("ScoreInfo"); } public plugin_precache() { precache_sound("misc/pb1.wav"); precache_sound("misc/pb2.wav"); precache_sound("misc/pb3.wav"); precache_sound("misc/pb4.wav"); precache_sound("misc/pbg.wav"); precache_model("models/shell.mdl"); precache_model("sprites/bhit.spr"); precache_model("sprites/richo1.spr"); precache_model("models/p_pbgun.mdl"); precache_model("models/v_pbgun.mdl"); } public ent_info(id) client_print(id,print_chat,"[AMXX] [Ent Info (Current/Max)] Paintballs: (%d/%d) Entities: (%d/%d)",g_ballsnum,get_pcvar_num(shots),engfunc(EngFunc_NumberOfEntities),global_get(glb_maxEntities)); public ev_curweapon(id) { static model[30]; pev(id,pev_viewmodel2,model,29); if (get_pcvar_num(onoff) && equali(model,"models/v_mp5.mdl")) { set_pev(id,pev_viewmodel2,"models/v_pbgun.mdl"); set_pev(id,pev_weaponmodel2,"models/p_pbgun.mdl"); } } public fw_updateclientdata(id,sw,cd_handle) { if (get_pcvar_num(onoff) && user_has_pbgun(id)) { set_cd(cd_handle,CD_flNextAttack,get_gametime()+0.001); return FMRES_HANDLED; } return FMRES_IGNORED; } public client_PreThink(id) { if (get_pcvar_num(onoff) && user_has_pbgun(id)) { new buttons = pev(id,pev_button); if (buttons & IN_ATTACK) { new ammo,null = get_user_weapon(id,ammo,null); if (ammo) { set_pev(id,pev_button,buttons & ~IN_ATTACK); new Float:gametime = get_gametime(); if (gametime-lastshot[id]>get_pcvar_float(speed)) { if (fire_paint(id)) { lastshot[id] = gametime; set_user_clip(id,ammo-1); set_pev(id,pev_punchangle,Float:{-0.5, 0.0, 0.0}); message_begin(MSG_ONE,SVC_WEAPONANIM,_,id); write_byte(3); write_byte(0); message_end(); if (get_pcvar_num(sound)) emit_sound(id,CHAN_AUTO,"misc/pbg.wav",1.0,ATTN_NORM,0,PITCH_NORM); } } } } } return PLUGIN_CONTINUE; } public fire_paint(id) { new ent; if (g_ballsnum < get_pcvar_num(shots)) ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); else if (engfunc(EngFunc_RemoveEntity,engfunc(EngFunc_FindEntityByString,ent,"classname","pbPaint"))) g_ballsnum--; if (pev_valid(ent)) { static Float:vangles[3],Float:nvelocity[3],Float:voriginf[3],vorigin[3]; set_pev(ent,pev_classname,"pbBullet"); set_pev(ent,pev_owner,id); set_pev(ent,pev_euser1,id); engfunc(EngFunc_SetModel,ent,"models/shell.mdl"); engfunc(EngFunc_SetSize,ent,Float:{-1.0,-1.0,-1.0},Float:{1.0,1.0,1.0}); get_user_origin(id,vorigin,1); IVecFVec(vorigin,voriginf); set_pev(ent,pev_origin,voriginf); pev(id,pev_v_angle,vangles); set_pev(ent,pev_angles,vangles); set_pev(ent,pev_v_angle,vangles); set_pev(ent,pev_solid,2); set_pev(ent,pev_movetype,5); velocity_by_aim(id,get_pcvar_num(veloc),nvelocity); set_pev(ent,pev_velocity,nvelocity); set_pev(ent,pev_nextthink,get_gametime()+(get_pcvar_num(blife)*1.6)); set_task(0.1,"bullet_glow",ent); g_ballsnum++; return ent; } return 0; } public pfn_touch(bullet,ent) { new class[30]; pev(bullet,pev_classname,class,29); if (!equali(class,"pbBullet")) return; new Float:origin[3],class2[30],owner = pev(bullet,pev_euser1); pev(ent,pev_classname,class2,29); pev(bullet,pev_origin,origin); if (is_user_alive(ent)) { new Float:origin2[3],Float:maxs[3],ffkill,headshot = 1; if (owner == ent || pev(ent,pev_takedamage) == DAMAGE_NO) return; if (get_user_team(owner) == get_user_team(ent)) if (get_cvar_num("mp_friendlyfire")) ffkill = 1; else return; pev(ent,pev_origin,origin2); pev(bullet,pev_maxs,maxs); origin[2] += maxs[2]; if (vector_distance(origin2,origin) <= 26.3) headshot = 0; origin[2] -= maxs[2]; user_silentkill(ent); if (is_user_connected(owner)) { set_pev(owner,pev_frags,float(ffkill ? get_user_frags(owner)-1 : get_user_frags(owner)+1)) message_begin(MSG_BROADCAST,Score); write_byte(owner); write_short(get_user_frags(owner)); write_short(cs_get_user_deaths(owner)); write_short(0); write_short(get_user_team(owner)); message_end(); make_deathmsg(owner,ent,headshot,"mp5navy"); if (ffkill) cs_set_user_tked(owner,1,0); } } if (pev_valid(bullet) && !equali(class,class2)) { static clr[3],wav[15]; set_pev(bullet,pev_velocity,Float:{0.0,0.0,0.0}); set_pev(bullet,pev_classname,"pbPaint"); set_pev(bullet,pev_solid,0); set_pev(bullet,pev_movetype,0); set_pev(bullet,pev_origin,origin); engfunc(EngFunc_SetModel,bullet,random_num(0,1) ? "sprites/bhit.spr" : "sprites/richo1.spr"); if (task_exists(bullet)) remove_task(bullet); if (get_pcvar_num(sound)) { switch (random_num(1,4)) { case 1: formatex(wav,14,"misc/pb1.wav"); case 2: formatex(wav,14,"misc/pb2.wav"); case 3: formatex(wav,14,"misc/pb3.wav"); case 4: formatex(wav,14,"misc/pb4.wav"); } emit_sound(bullet,CHAN_AUTO,wav,1.0,ATTN_NORM,0,PITCH_NORM); } switch (get_pcvar_num(color)) { case 2: clr = (get_user_team(owner)==1) ? {255,0,0} : {0,0,255}; default: { switch (random_num(1,8)) { case 1: clr = {255,255,255} //white case 2: clr = {255,0,0} //red case 3: clr = {0,255,0} //green case 4: clr = {0,0,255} //blue case 5: clr = {255,255,0} //yellow case 6: clr = {255,0,255} //magenta case 7: clr = {255,20,147} //pink case 8: clr = {255,165,0} //orange } } } set_rendering2(bullet,kRenderFxNoDissipation,clr[0],clr[1],clr[2],kRenderGlow,255); set_pev(bullet,pev_flags,FL_ALWAYSTHINK); set_pev(bullet,pev_nextthink,get_gametime()+get_pcvar_num(blife)); } } public pfn_think(ent) { if (pev_valid(ent)) { static class[30]; pev(ent,pev_classname,class,29); if (equali(class,"pbPaint") || equali(class,"pbBullet")) { engfunc(EngFunc_RemoveEntity,ent); g_ballsnum--; } } } public bullet_glow(ent) { if (pev_valid(ent)) { static clr[3]; switch (get_pcvar_num(color)) { case 2: clr = (get_user_team(pev(ent,pev_euser1))==1) ? {255,0,0} : {0,0,255}; default: clr = {255,255,255}; } set_rendering2(ent,kRenderFxGlowShell,clr[0],clr[1],clr[2],kRenderNormal,255); } } public new_round() { new ent = -1; while (((ent = engfunc(EngFunc_FindEntityByString,ent,"classname","pbPaint")) != 0) || ((ent = engfunc(EngFunc_FindEntityByString,ent,"classname","pbBullet")) != 0)) engfunc(EngFunc_RemoveEntity,ent); g_ballsnum = 0; } stock user_has_pbgun(id) { if (is_user_alive(id)) { static model[30]; pev(id,pev_viewmodel2,model,29); if (equali(model,"models/v_pbgun.mdl")) return 1; } return 0; } stock set_user_clip(id,ammo) { new wpn[32],WPNid=-1,null,weaponid = get_user_weapon(id,null,null); get_weaponname(weaponid,wpn,31); while ((WPNid = engfunc(EngFunc_FindEntityByString,WPNid,"classname",wpn)) != 0) if (id == pev(WPNid,pev_owner)){ cs_set_weapon_ammo(WPNid,ammo); return WPNid; } return 0; } // teame06's function stock set_rendering2(index,fx,r,g,b,render,amount) { set_pev(index, pev_renderfx, fx); new Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(index, pev_rendercolor, RenderColor); set_pev(index, pev_rendermode, render); set_pev(index, pev_renderamt, float(amount)); } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par } */
and
PHP Code:
#include <amxmodx> #include <engine> #include <fakemeta_util> #include <cstrike> #include <hamsandwich> #include <amxmisc> #include <fun> #define MAX_PLAYERS 32 #define MAX_BLOOD_DISTANCE 64 #define LOADUP_TIME 0.75 #define SHUTDOWN_TIME 1.7 #define SHAKE_FORCE -5.0 //(must be negative value) new const GUNSHOT_DECALS[] = {41, 42, 43, 44, 45} // Gunshot decal list // Plugin information new const PLUGIN[] = "WPN Minigun" new const VERSION[] = "1.65" new const AUTHOR[] = "CLLlAgOB" // other new bool:has_minigun[33], m249, bool:atk2[33], bool:atk1[33], bool:delay[33], clipp[33],clipstart,g_fwid,bool:delayhud[33],bool:beackup[33], mcost,msg[128],bool:frstCLIP[33],g_MaxPlayers,g_guns_eventids_bitsum,bool:haswhpnnmg[33], Float:g_lastShot[33], Float:g_nextSound[33], g_plAction[33],bool:g_fix_punchangle[33], bool:canfire[33],oneround,only_adminCB,MsgSayText,g_normal_trace[33],DMGMG,bool:user_bot[33], bool:is_alive[33],bool:is_connected[33] // Blood new g_blood new g_bloodspray // CS Player PData Offsets (win32) const OFFSET_CSTEAMS = 114 // Linux diff's const OFFSET_LINUX = 5 // offsets 5 higher in Linux builds // Models new P_MODEL[] = "models/wpnmod/m134/p_minigun.mdl" new V_MODEL[] = "models/wpnmod/m134/v_minigun.mdl" new W_MODEL[] = "models/wpnmod/m134/w_minigun.mdl" // Sounds new m_SOUND[][] = {"wpnmod/minigun/hw_shoot1.wav", "wpnmod/minigun/hw_spin.wav", "wpnmod/minigun/hw_spinup.wav", "wpnmod/minigun/hw_spindown.wav"} new g_noammo_sounds[][] = {"weapons/dryfire_rifle.wav"} //no recoil new const g_guns_events[][] = {"events/m249.sc"} //connect #define is_user_valid_connected(%1) (1 <= %1 <= g_MaxPlayers && is_connected[%1]) enum { anim_idle, anim_idle2, anim_gentleidle, anim_stillidle, anim_draw, anim_holster, anim_spinup, anim_spindown, anim_spinidle, anim_spinfire, anim_spinidledown } // Types enum { act_none, act_load_up, act_run } public plugin_precache() { precache_model(P_MODEL) precache_model(V_MODEL) precache_model(W_MODEL) precache_sound(m_SOUND[0]) precache_sound(m_SOUND[1]) precache_sound(m_SOUND[2]) precache_sound(m_SOUND[3]) g_blood = precache_model("sprites/blood.spr") g_bloodspray = precache_model("sprites/bloodspray.spr") g_fwid = register_forward(FM_PrecacheEvent, "fwPrecacheEvent", 1) } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_dictionary("minigun.txt") MsgSayText = get_user_msgid("SayText") clipstart = register_cvar("amx_ammo_mini","600") m249 = register_cvar("amx_speed_mini","0.9") DMGMG = register_cvar("amx_minigun_damage","1.2") oneround = register_cvar("amx_oneround","0") mcost = register_cvar("amx_cost_mini","10000") only_adminCB = register_cvar("amx_only_adm_buy","0") register_event("CurWeapon","event_curweapon","be", "1=1") register_event("DeathMsg","unminigun","a") register_forward(FM_ClientDisconnect, "fw_ClientDisconnect") register_forward(FM_CmdStart, "fwd_CmdStart") register_forward(FM_EmitSound,"fwd_emitsound") register_forward(FM_PlaybackEvent, "fwPlaybackEvent") register_forward(FM_PlayerPostThink, "fwPlayerPostThink", 1) register_forward(FM_StartFrame, "fwd_StartFrame") register_forward(FM_UpdateClientData, "UpdateClientData_Post", 1) RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1) RegisterHam(Ham_TakeDamage, "player", "player_TakeDamage") register_clcmd("say /minigun","buymini") register_concmd("amx_minigun_give", "cmdMinigun_give", ADMIN_LEVEL_A, "<@all or name/id> <ammo>") register_clcmd("drop","dropcmd") //events // Get Max Players g_MaxPlayers = global_get(glb_maxClients) register_logevent("event_start", 2, "1=Round_Start") register_event("TextMsg", "fwEvGameWillRestartIn", "a", "2=#Game_will_restart_in") register_event("HLTV", "event_start_freezetime", "a", "1=0", "2=0") unregister_forward(FM_PrecacheEvent, g_fwid, 1) } // Client joins the game public client_putinserver(id) { // Player joined is_connected[id] = true } // Client leaving public fw_ClientDisconnect(id) { is_connected[id] = false is_alive[id] = false } public fw_PlayerSpawn_Post(id) { // Not alive or didn't join a team yet if (!is_user_alive(id) || !fm_cs_get_user_team(id)) return; // Player spawned is_alive[id] = true } public fw_PlayerKilled(victim, attacker, shouldgib) { //player die is_alive[victim] = false } public unminigun(){ new id = read_data(2) if(has_minigun[id] && !is_alive[id]) { new Float:Aim[3],Float:origin[3] VelocityByAim(id, 64, Aim) entity_get_vector(id,EV_VEC_origin,origin) origin[0] += Aim[0] origin[1] += Aim[1] new minigun = create_entity("info_target") entity_set_string(minigun,EV_SZ_classname,"minigun") entity_set_model(minigun,W_MODEL) entity_set_size(minigun,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0}) entity_set_int(minigun,EV_INT_solid,1) entity_set_int(minigun,EV_INT_movetype,6) entity_set_int(minigun, EV_INT_iuser1, clipp[id]) entity_set_vector(minigun,EV_VEC_origin,origin) has_minigun[id] = false remowegun(id) return PLUGIN_HANDLED } return PLUGIN_CONTINUE } //damage lvl public player_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype) { if(damagetype & DMG_BULLET && haswhpnnmg[attacker] && has_minigun[attacker] == true && attacker!=victim) { damage = damage*get_pcvar_float(DMGMG) SetHamParamFloat(4, damage) return HAM_IGNORED } return HAM_IGNORED } public cmdMinigun_give(id, level, cid) { if (!cmd_access(id, level, cid, 3)) { return PLUGIN_HANDLED } new arg[32], arg2[8], name2[32], argument2 read_argv(1,arg,31) read_argv(2,arg2,7) argument2 = str_to_num(arg2) if ( equali(arg,"@all") ){ new plist[32],pnum get_players(plist,pnum,"a") if (pnum==0) { console_print(id,"[Minigun] This client is invalid") return PLUGIN_HANDLED } for (new i=0; i<pnum; i++) { give_weapon(plist[i], argument2, 1) client_print(plist[i], print_chat, "[Minigun] %L", LANG_PLAYER, "MINIGUN_ADMIN_GIVE_ALL",argument2) } } else { get_user_name(id,name2,31) new player = cmd_target(id,arg,7) if (!player) { console_print(id,"[Minigun] Give Minigun Failed") return PLUGIN_HANDLED } new name[32] get_user_name(player,name,31) give_weapon(player, argument2, 1) client_print(0, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_ADMIN_GIVE",name,argument2) return PLUGIN_HANDLED } return PLUGIN_HANDLED } public buymini(id) { if ((!(get_user_flags(id) & ADMIN_IMMUNITY) || !(get_user_flags(id) & ADMIN_RESERVATION)) && get_pcvar_num(only_adminCB)) { format(msg,256,"[Minigun] %L", LANG_PLAYER,"MINIGUN_ADMIN_BUY") message_begin(MSG_ONE,MsgSayText,{0,0,0},id) write_byte(id) write_string(msg) message_end() return PLUGIN_HANDLED } new money = cs_get_user_money(id) new price = get_pcvar_num(mcost) if(!is_alive[id]) client_print(id, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_ALIVE") else if(has_minigun[id]) client_print(id, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_ALREADY") else if(money < price) client_print(id, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_NO_MONEY") else{ cs_set_user_money(id, money - price) give_weapon(id, 0, 1) client_print(id, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_BUY",price) } return PLUGIN_HANDLED } public dropcmd(id) { if(has_minigun[id] && haswhpnnmg[id] && is_alive[id]) { new Float:Aim[3],Float:origin[3] VelocityByAim(id, 64, Aim) entity_get_vector(id,EV_VEC_origin,origin) origin[0] += Aim[0] origin[1] += Aim[1] new minigun = create_entity("info_target") entity_set_string(minigun,EV_SZ_classname,"minigun") entity_set_model(minigun,W_MODEL) entity_set_size(minigun,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0}) entity_set_int(minigun,EV_INT_solid,1) entity_set_int(minigun,EV_INT_movetype,6) entity_set_int(minigun, EV_INT_iuser1, clipp[id]) entity_set_vector(minigun,EV_VEC_origin,origin) has_minigun[id] = false canfire[id] = false remowegun(id) g_plAction[id] = false return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public pfn_touch(ptr, ptd) { if(is_valid_ent(ptr)) { new classname[32] entity_get_string(ptr,EV_SZ_classname,classname,31) if(equal(classname, "minigun")) { if(is_valid_ent(ptd)) { new id = ptd if(id > 0 && id < 34) { if(!has_minigun[id] && is_alive[id]) { give_weapon(id,entity_get_int(ptr, EV_INT_iuser1), 0) canfire[id] = true remove_entity(ptr) } } } } } } public remove_miniguns() { new nextitem = find_ent_by_class(-1,"minigun") while(nextitem) { remove_entity(nextitem) nextitem = find_ent_by_class(-1,"minigun") } return PLUGIN_CONTINUE } public event_start_freezetime(){ remove_miniguns() static iPlayers[32], iPlayersNum, i get_players(iPlayers, iPlayersNum, "a") if(!get_pcvar_num(only_adminCB)){ for (i = 0; i <= iPlayersNum; ++i){ if(!has_minigun[iPlayers[i]]){ set_task(random_float(0.1,1.0),"msghelp",iPlayers[i]) } } } if(get_pcvar_num(oneround)){ for (i = 0; i <= iPlayersNum; ++i){ if(has_minigun[iPlayers[i]]){ has_minigun[iPlayers[i]] = false remowegun(iPlayers[i]) } } } else { for (i = 0; i <= iPlayersNum; ++i){ g_plAction[iPlayers[i]] = false canfire[iPlayers[i]] = false frstCLIP[iPlayers[i]] = true } } } // remove gun and save all guns public remowegun(id) { new wpnList[32] new number get_user_weapons(id,wpnList,number) for (new i = 0;i < number ;i++) { if (wpnList[i] == CSW_M249) { fm_strip_user_gun(id, wpnList[i]) } } } public msghelp(id){ client_print(id, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_FOR_BUY") client_print(id, print_chat, "[Minigun] %L", LANG_PLAYER,"MINIGUN_PRICE",get_pcvar_num(mcost)) } public event_start(){ static iPlayers[32], iPlayersNum, i get_players(iPlayers, iPlayersNum, "a") for (i = 0; i <= iPlayersNum; ++i) canfire[iPlayers[i]] = true } public fwEvGameWillRestartIn() { static iPlayers[32], iPlayersNum, i get_players(iPlayers, iPlayersNum, "a") for (i = 0; i <= iPlayersNum; ++i) has_minigun[iPlayers[i]] = false } public client_connect(id){ canfire[id]= false has_minigun[id] = false g_normal_trace[id] = 0 if(is_user_bot(id)) user_bot[id] = true else user_bot[id] = false } //block sound no ammo in atack public fwd_emitsound(id, channel, sample[], Float:volume, Float:attn, flag, pitch) { if (!is_user_valid_connected(id) || !has_minigun[id]) return FMRES_IGNORED; else if((equal(sample, g_noammo_sounds[0])) && has_minigun[id] && haswhpnnmg[id]) { return FMRES_SUPERCEDE } return FMRES_IGNORED } //give wpn public give_weapon(id, ammo, frst){ has_minigun[id] = true give_item(id,"weapon_m249") canfire[id] = true clipp[id] = ammo if(frst) frstCLIP[id] = true else beackup[id] = true }
//play anim public native_playanim(player,anim) { set_pev(player, pev_weaponanim, anim) message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, player) write_byte(anim) write_byte(pev(player, pev_body)) message_end() }
public fwd_CmdStart(id, uc_handle, seed) { if(!is_alive[id] || !canfire[id] || !has_minigun[id]) return FMRES_HANDLED if(haswhpnnmg[id]) { static buttons buttons = get_uc(uc_handle, UC_Buttons) if(buttons & IN_ATTACK) { atk1[id] = true atk2[id] = false } else if(buttons & IN_ATTACK2) { atk2[id] = true atk1[id] = false } if(atk1[id] && !atk2[id] && (g_plAction[id] == act_none || g_plAction[id] == act_load_up) && clipp[id]>0){ buttons &= ~IN_ATTACK buttons &= ~IN_ATTACK2 set_uc(uc_handle, UC_Buttons, buttons) fire_mode(id,0) } else if(atk2[id] || atk1[id] && clipp[id]==0){ fire_mode(id,1) } } return FMRES_IGNORED } // in fire fire_mode(id, type) { static Float:gtime gtime = get_gametime() g_lastShot[id] = gtime if(g_nextSound[id] <= gtime && canfire[id]) { switch(g_plAction[id]) { case act_none: { native_playanim(id, anim_spinup) emit_sound(id, CHAN_WEAPON, m_SOUND[2], 1.0, ATTN_NORM, 0, PITCH_NORM) g_nextSound[id] = gtime + LOADUP_TIME g_plAction[id] = act_load_up } case act_load_up: { g_nextSound[id] = gtime g_plAction[id] = act_run } } } if(g_plAction[id] == act_run) { if(type == 0 && clipp[id]>0 && atk1[id]){ emit_sound(id, CHAN_WEAPON, m_SOUND[0], 1.0, ATTN_NORM, 0, PITCH_NORM) testbulet(id) if(!delay[id]) { native_playanim(id, anim_spinfire) ammo_hud(id) set_task(0.2,"delayanim",id) delay[id] = true } } else { if(!delay[id]) { ammo_hud(id) emit_sound(id, CHAN_WEAPON, m_SOUND[1], 1.0, ATTN_NORM, 0, PITCH_NORM) native_playanim(id, anim_spinidle) set_task(0.2,"delayanim",id) delay[id] = true } } } atk1[id] = false atk2[id] = false } public delayanim(id){ delay[id] = false } //set models public event_curweapon(id){ if(!is_alive[id] || !is_connected[id] || user_bot[id]) return; new clip, ammo, weapon = get_user_weapon(id, clip, ammo) if((has_minigun[id]) && (weapon == CSW_M249)){ if(g_plAction[id] != act_run && frstCLIP[id]){ new ent = get_weapon_ent(id,weapon) if(clipp[id] < get_pcvar_num(clipstart)) clipp[id] = get_pcvar_num(clipstart) cs_set_weapon_ammo(ent, clipp[id]) frstCLIP[id] = false } if(g_plAction[id] != act_run && beackup[id]){ new ent = get_weapon_ent(id,weapon) cs_set_weapon_ammo(ent, clipp[id]) beackup[id] = false } if(clipp[id] == 0){ new ent = get_weapon_ent(id,weapon) cs_set_weapon_ammo(ent, clipp[id]) } if(g_plAction[id] == act_run){ clipp[id] = clip } message_begin(MSG_ONE, get_user_msgid("CurWeapon"), {0,0,0}, id) write_byte(1) write_byte(CSW_KNIFE) write_byte(0) message_end() if(!haswhpnnmg[id]){ entity_set_string(id,EV_SZ_viewmodel,V_MODEL) entity_set_string(id,EV_SZ_weaponmodel,P_MODEL) haswhpnnmg[id] = true } new Ent = get_weapon_ent(id,weapon) new Float:N_Speed if(Ent) { N_Speed = get_pcvar_float(m249) new Float:Delay = get_pdata_float( Ent, 46, 4) * N_Speed if (Delay > 0.0){ set_pdata_float( Ent, 46, Delay, 4) } } ammo_hud(id) if(atk1[id]){ fire_mode(id, 0) } if(atk2[id]){ fire_mode(id, 1) } } if(weapon != CSW_M249) haswhpnnmg[id] = false if((has_minigun[id]) && (!haswhpnnmg[id])) g_plAction[id] = act_none return; } //sound and anim public fwd_StartFrame() { static Float:gtime, id gtime = get_gametime() for(id = 0; id <= g_MaxPlayers; id++) { if(g_plAction[id] != act_none) { if(!(pev(id, pev_button) & IN_ATTACK) && !(pev(id, pev_button) & IN_ATTACK2) && g_lastShot[id] + 0.2 < gtime) { native_playanim(id, anim_spinidledown) emit_sound(id, CHAN_WEAPON, m_SOUND[3], 1.0, ATTN_NORM, 0, PITCH_NORM) g_nextSound[id] = gtime + SHUTDOWN_TIME g_plAction[id] = act_none } } } } //marks on hit public native_gi_get_gunshot_decal() { return GUNSHOT_DECALS[random_num(0, sizeof(GUNSHOT_DECALS) - 1)] } //hit bulet public testbulet(id){ // Find target new aimOrigin[3], target, body get_user_origin(id, aimOrigin, 3) get_user_aiming(id, target, body) if(target > 0 && target <= g_MaxPlayers) { new Float:fStart[3], Float:fEnd[3], Float:fRes[3], Float:fVel[3] pev(id, pev_origin, fStart) // Get ids view direction velocity_by_aim(id, MAX_BLOOD_DISTANCE, fVel) // Calculate position where blood should be displayed fStart[0] = float(aimOrigin[0]) fStart[1] = float(aimOrigin[1]) fStart[2] = float(aimOrigin[2]) fEnd[0] = fStart[0]+fVel[0] fEnd[1] = fStart[1]+fVel[1] fEnd[2] = fStart[2]+fVel[2] // Draw traceline from victims origin into ids view direction to find // the location on the wall to put some blood on there new res engfunc(EngFunc_TraceLine, fStart, fEnd, 0, target, res) get_tr2(res, TR_vecEndPos, fRes) // Show some blood :) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BLOODSPRITE) write_coord(floatround(fStart[0])) write_coord(floatround(fStart[1])) write_coord(floatround(fStart[2])) write_short(g_bloodspray) write_short(g_blood) write_byte(70) write_byte(random_num(1,2)) message_end() } else { new decal = native_gi_get_gunshot_decal() // Check if the wall hit is an entity if(target) { // Put decal on an entity message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_DECAL) write_coord(aimOrigin[0]) write_coord(aimOrigin[1]) write_coord(aimOrigin[2]) write_byte(decal) write_short(target) message_end() } else { // Put decal on "world" (a wall) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_WORLDDECAL) write_coord(aimOrigin[0]) write_coord(aimOrigin[1]) write_coord(aimOrigin[2]) write_byte(decal) message_end() } // Show sparcles message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_GUNSHOTDECAL) write_coord(aimOrigin[0]) write_coord(aimOrigin[1]) write_coord(aimOrigin[2]) write_short(id) write_byte(decal) message_end() } }
//block anim standart wpn public UpdateClientData_Post( id, sendweapons, cd_handle ){ if ( !is_alive[id] ) return FMRES_IGNORED; if(haswhpnnmg[id] && has_minigun[id]) set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001 ); return FMRES_HANDLED; } // No recoil stuff public fwPrecacheEvent(type, const name[]) { for (new i = 0; i < sizeof g_guns_events; ++i) { if (equal(g_guns_events[i], name)) { g_guns_eventids_bitsum |= (1<<get_orig_retval()) return FMRES_HANDLED } } return FMRES_IGNORED } public fwPlaybackEvent(flags, invoker, eventid) { if (!(g_guns_eventids_bitsum & (1<<eventid)) || !(1 <= invoker <= g_MaxPlayers)|| !haswhpnnmg[invoker] || !has_minigun[invoker]) return FMRES_IGNORED g_fix_punchangle[invoker] = true return FMRES_HANDLED } public fwPlayerPostThink(id) { if (g_fix_punchangle[id]) { g_fix_punchangle[id] = false set_pev(id, pev_punchangle, Float:{0.0, 0.0, 0.0}) return FMRES_HANDLED } return FMRES_IGNORED } public fwTraceLine(const Float:start[3], const Float:dest[3], ignore_monsters, id, ptr) { if (!(1 <= id <= g_MaxPlayers)) return FMRES_IGNORED if (!g_normal_trace[id]) { g_normal_trace[id] = ptr return FMRES_HANDLED } if (ptr == g_normal_trace[id] || ignore_monsters != DONT_IGNORE_MONSTERS || !haswhpnnmg[id] || !has_minigun[id] || !is_alive[id]) return FMRES_IGNORED fix_recoil_trace(id, start, ptr) return FMRES_SUPERCEDE } // show ammo clip public ammo_hud(id) { if(!delayhud[id]) { delayhud[id] = true new AmmoHud[65] new clip = clipp[id] format(AmmoHud, 64, "Ammo: %i", clip) set_hudmessage(200, 100, 0, 1.0 , 1.0, 0, 0.1, 0.1,0.1) show_hudmessage(id,"%s",AmmoHud) set_task(0.2,"delayhutmsg",id) } } public delayhutmsg(id){ delayhud[id]= false } //get weapon id stock get_weapon_ent(id,wpnid=0,wpnName[]="") { // who knows what wpnName will be static newName[24]; // need to find the name if(wpnid) get_weaponname(wpnid,newName,23); // go with what we were told else formatex(newName,23,"%s",wpnName); // prefix it if we need to if(!equal(newName,"weapon_",7)) format(newName,23,"weapon_%s",newName); return fm_find_ent_by_owner(get_maxplayers(),newName,id); } fix_recoil_trace(id, const Float:start[], ptr) { static Float:dest[3] pev(id, pev_v_angle, dest) engfunc(EngFunc_MakeVectors, dest) global_get(glb_v_forward, dest) xs_vec_mul_scalar(dest, 9999.0, dest) xs_vec_add(start, dest, dest) engfunc(EngFunc_TraceLine, start, dest, DONT_IGNORE_MONSTERS, id, ptr) } // Get User Team stock fm_cs_get_user_team(id) { return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX); }
can mix code ??
list weapons
weapon_m4a1
weapon_ak47
weapon_mp5navy
weapon_usp
weapon_glock18
weapon_deagle
weapon_p228
weapon_elite
weapon_fiveseven
weapon_m3
weapon_xm1014
weapon_tmp
weapon_p90
weapon_mac10
weapon_ump4
weapon_sg552
weapon_sg552
weapon_scout
weapon_awp
weapon_g3sg1
weapon_sg550
weapon_m249
weapon_galil
CSW_P228
CSW_SCOUT
CSW_HEGRENADE
CSW_XM1014
CSW_C4
CSW_MAC10
CSW_AUG
CSW_SMOKEGRENADE
CSW_ELITE
CSW_FIVESEVEN
CSW_UMP45
CSW_SG550
CSW_GALI
CSW_GALIL
CSW_FAMAS
CSW_USP
CSW_GLOCK18
CSW_AWP
CSW_MP5NAVY
CSW_M249
CSW_M3
CSW_M4A1
CSW_TMP
CSW_G3SG1
CSW_FLASHBANG
CSW_DEAGLE
CSW_SG552
CSW_AK47
CSW_KNIFE
CSW_P90
from mp5navy add more weapon ??
paintballgun.amxx v5.10 no error run on hlds. (hlds update from steam)
but in version 5.10 i use weapon can't shoot run on AMX 1.8.1
paintball v1.1 i can shoot.
List Module running on Hlds
CStrike 1.8.1.3746 AMX Mod X Dev Team running
CSX 1.8.1.3746 AMX Mod X Dev Team running
Engine 1.8.1.3746 AMX Mod X Dev Team running
FakeMeta 1.8.1.3746 AMX Mod X Dev Team running
Fun 1.8.1.3746 AMX Mod X Dev Team running
Ham Sandwich 1.8.1.3746 AMX Mod X Dev Team running
MySQL 1.8.1.3746 AMX Mod X Dev Team running
nVault 1.8.1.3746 AMX Mod X Dev Team running
SQLite 1.8.1.3746 AMX Mod X Dev Team running
Orpheu 2.3a joaquimandrade running
GeoIP 1.71 AMX Mod X Dev Team running
RegEx 1.8.1.3746 AMX Mod X Dev Team running
Sockets 1.8.1.3746 HLSW Dev Team running
Loniu help me
__________________
Last edited by Boylive; 04-21-2011 at 11:45.
|
|