hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.23. 17:26



Jelenlévő felhasználók

Jelenleg 145 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 144 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: CSO Dual Balrog segítség
HozzászólásElküldve: 2013.04.05. 17:13 
Offline
Veterán
Avatar

Csatlakozott: 2011.11.17. 15:48
Hozzászólások: 1904
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 54 alkalommal
Helló .
Valaki tudna ebben segítteni ??
Nem tudom mi a hiba

SMA Forráskód: [ Mindet kijelol ]
  1.  
  2. #include <amxmodx>
  3. #include <amxmisc>
  4. #include <fakemeta>
  5. #include <fakemeta_util>
  6. #include <hamsandwich>
  7. #include <fun>
  8. #include <engine>
  9. #include <cstrike>
  10. #include <zombieplague>
  11. #define EWEAPON_W_MODEL "models/cso_wpn/w_balrog3.mdl"
  12. #define EWEAPON_V_MODEL "models/cso_wpn/v_balrog3.mdl"
  13. #define EWEAPON_P_MODEL "models/cso_wpn/p_balrog3.mdl"
  14. #define EWEAPON_SOUND_FIRE "weapons/cso/balrog3_shoot.wav"
  15. #define EWEAPON_SOUND_EMPTY "weapons/ak47_clipout.wav"
  16. #define EWEAPON_SOUND_DRAW "weapons/cso/balrog3_draw.wav
  17.  
  18. #define EWEAPON_LOGNAME "Dual Balrog"
  19.  
  20. #define EWEAPON_WEAPONKEY 1200788
  21. #define EWEAPON_BASE_WEAPON "weapon_ump45"
  22.  
  23. #define EWEAPON_CLIPSIZE 50
  24. #define EWEAPON_START_AMMO 300
  25.  
  26. #define EWEAPON_SHOOT_NEXTATTACKTIME 0.1
  27. #define EWEAPON_SHOOT_NEXTIDLETIME 0.1
  28. #define EWEAPON_SHOOTEMPTY_NEXTATTACKTIME 0.2
  29. #define EWEAPON_SHOOTEMPTY_NEXTIDLETIME 0.2
  30. #define EWEAPON_RELOAD_TIME 2.3
  31. #define EWEAPON_BASE_DAMAGE 100.0
  32.  
  33. #define EWEAPON_HORIZONTAL_RECOIL 150
  34. #define EWEAPON_VERTICAL_RECOIL 1
  35.  
  36. #define ANIM_IDLE 0
  37. #define ANIM_IDLE_EMPTY 3
  38. #define ANIM_RELOAD 4
  39. #define ANIM_DRAW 5
  40. #define ANIM_DRAW_EMPTY 2
  41. #define ANIM_FIRE1 1
  42. #define ANIM_FIRE2 1
  43. #define ANIM_FIRE3 1
  44.  
  45. #define ANIM_PLAYER_POSTFIX "rifle"
  46.  
  47. /* ------------------------------------------------- */
  48.  
  49. new g_EWeaponId = 0;
  50. new g_OriginalWModel[128];
  51. #define EV_INT_WEAPONKEY EV_INT_impulse
  52. #define MAX_PLAYERS 32
  53.  
  54. new DecalsShot[5] = {41, 42, 43, 44, 45};
  55. new g_BloodDecals[6];
  56. new g_BloodSprite[2];
  57.  
  58. enum _:e_EWepState
  59. {
  60. bool:wep_have,
  61. bool:wep_active,
  62. wep_ent,
  63. wep_TmpClip,
  64. };
  65.  
  66. new g_EWepPlayerData[MAX_PLAYERS+1][e_EWepState];
  67.  
  68. //CBaseWeapon fields
  69. #define m_fKnown 44
  70. #define m_flNextPrimaryAttack 46
  71. #define m_flTimeWeaponIdle 48
  72. #define m_iClip 51
  73. #define m_fInReload 54
  74. #define m_flNextAttack 83
  75. #define CBASEWEAPON_LINUX_XTRA_OFF 4
  76.  
  77. new const g_item_name[] = { "\wDual Balrog\r[CSO]" };
  78. new g_itemid_guitar;
  79. const g_item_cost = 18;
  80.  
  81. #if defined FIRE_WATERSPRAY
  82. new tracer_sprite;
  83. new tracer_sprite2;
  84. #endif //FIRE_WATERSPRAY
  85.  
  86. public plugin_init() {
  87. register_plugin("[ZP] Extra: Guitar!", "0.7.0", "Crock");
  88. g_itemid_guitar = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN);
  89.  
  90. InitDecals();
  91.  
  92. RegisterHam(Ham_Weapon_PrimaryAttack, EWEAPON_BASE_WEAPON, "CWeapon__PrimaryAttack");
  93. RegisterHam(Ham_Item_Deploy, EWEAPON_BASE_WEAPON, "CWeapon__Deploy", 1);
  94. RegisterHam(Ham_Item_AddToPlayer, EWEAPON_BASE_WEAPON, "CWeapon__AddToPlayer");
  95. RegisterHam(Ham_Item_AttachToPlayer, EWEAPON_BASE_WEAPON, "CWeapon__AttachToPlayer");
  96. RegisterHam(Ham_Item_PostFrame, EWEAPON_BASE_WEAPON, "CWeapon__ItemPostFrame");
  97. RegisterHam(Ham_Weapon_Reload, EWEAPON_BASE_WEAPON, "CWeapon__Reload");
  98. RegisterHam(Ham_Weapon_Reload, EWEAPON_BASE_WEAPON, "CWeapon__Reload_Post", 1);
  99.  
  100. register_forward(FM_SetModel, "CWeapon__SetModel");
  101. register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1);
  102. register_event("CurWeapon", "event_curweapon", "be", "1=1");
  103. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
  104.  
  105. g_EWeaponId = get_weaponid(EWEAPON_BASE_WEAPON);
  106. }
  107.  
  108. stock InitDecals()
  109. {
  110. g_BloodDecals[0] = get_decal_index("{blood1");
  111. g_BloodDecals[1] = get_decal_index("{blood2");
  112. g_BloodDecals[2] = get_decal_index("{blood3");
  113. g_BloodDecals[3] = get_decal_index("{blood4");
  114. g_BloodDecals[4] = get_decal_index("{blood5");
  115. g_BloodDecals[5] = get_decal_index("{blood6");
  116. }
  117.  
  118. public plugin_precache() {
  119. precache_model(dualbalrog_V_MODEL)
  120. precache_model(dualbalrog_P_MODEL)
  121. precache_model(dualbalrog_W_MODEL)
  122.  
  123. precache_sound(dualbalrog_SOUND_FIRE);
  124. precache_sound(dualbalrog_SOUND_EMPTY);
  125. precache_sound(dualbalrog_SOUND_DRAW);
  126.  
  127. }
  128.  
  129. public CWeapon__PrimaryAttack(weapon_entity) {
  130. if(!is_valid_ent(weapon_entity))
  131. return HAM_IGNORED;
  132.  
  133. new id = pev(weapon_entity, pev_owner)
  134. if (!is_user_connected(id))
  135. return HAM_IGNORED;
  136.  
  137. if (!g_EWepPlayerData[id][wep_have])
  138. return HAM_IGNORED;
  139.  
  140. static szClassName[33]
  141. entity_get_string(weapon_entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  142.  
  143. new iClip = get_pdata_int(weapon_entity, m_iClip, CBASEWEAPON_LINUX_XTRA_OFF)
  144. if (iClip <= 0) {
  145. send_weapon_animation(id, ANIM_IDLE_EMPTY)
  146. engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, EWEAPON_SOUND_EMPTY, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  147.  
  148. set_pdata_float(weapon_entity, m_flNextPrimaryAttack, EWEAPON_SHOOTEMPTY_NEXTATTACKTIME, CBASEWEAPON_LINUX_XTRA_OFF)
  149. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, EWEAPON_SHOOTEMPTY_NEXTIDLETIME, CBASEWEAPON_LINUX_XTRA_OFF)
  150.  
  151. return HAM_SUPERCEDE;
  152. }
  153. iClip--;
  154. set_pdata_int(weapon_entity, m_iClip, iClip, CBASEWEAPON_LINUX_XTRA_OFF);
  155.  
  156. new anim;
  157. switch (random_num(0,2)) {
  158. case 0: anim = ANIM_FIRE1;
  159. case 1: anim = ANIM_FIRE2;
  160. default: anim = ANIM_FIRE3;
  161. }
  162. send_weapon_animation(id, anim);
  163.  
  164.  
  165. /* player model animation */
  166.  
  167. engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, EWEAPON_SOUND_FIRE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  168.  
  169.  
  170. static Float:plrViewAngles[3], Float:VecEnd[3], Float:VecDir[3], Float:PlrOrigin[3];
  171. pev(id, pev_v_angle, plrViewAngles);
  172.  
  173. static Float:VecSrc[3], Float:VecDst[3];
  174.  
  175. //VecSrc = pev->origin + pev->view_ofs;
  176. pev(id, pev_origin, PlrOrigin)
  177. pev(id, pev_view_ofs, VecSrc)
  178. xs_vec_add(VecSrc, PlrOrigin, VecSrc)
  179.  
  180. //VecDst = VecDir * 8192.0;
  181. angle_vector(plrViewAngles, ANGLEVECTOR_FORWARD, VecDir);
  182. xs_vec_mul_scalar(VecDir, 8192.0, VecDst);
  183. xs_vec_add(VecDst, VecSrc, VecDst);
  184.  
  185. new hTrace = create_tr2()
  186. engfunc(EngFunc_TraceLine, VecSrc, VecDst, 0, id, hTrace)
  187. new hitEnt = get_tr2(hTrace, TR_pHit);
  188. get_tr2(hTrace, TR_vecEndPos, VecEnd);
  189.  
  190. #if defined FIRE_WATERSPRAY
  191. create_tracer_water(id, VecSrc, VecEnd)
  192. #endif //FIRE_WATERSPRAY
  193.  
  194. new bool:bNeedDrawShot = true;
  195.  
  196. if (pev_valid(hitEnt)) {
  197. new Float:takeDamage;
  198. pev(hitEnt, pev_takedamage, takeDamage);
  199.  
  200. if (takeDamage != 0.0) {
  201. bNeedDrawShot = false;
  202.  
  203. new Float:dmg = EWEAPON_BASE_DAMAGE;
  204.  
  205. new hitGroup = get_tr2(hTrace, TR_iHitgroup);
  206.  
  207. switch (hitGroup) {
  208. case HIT_HEAD: { dmg *= 1.0; }
  209. case HIT_LEFTARM: { dmg *= 0.5; }
  210. case HIT_RIGHTARM: { dmg *= 0.5; }
  211. case HIT_LEFTLEG: { dmg *= 0.5; }
  212. case HIT_RIGHTLEG: { dmg *= 0.5; }
  213. }
  214.  
  215. if (is_user_connected(hitEnt) && zp_get_user_zombie(hitEnt)) {
  216. ExecuteHamB(Ham_TakeDamage, hitEnt, id, id, dmg, DMG_BULLET | DMG_NEVERGIB);
  217. ExecuteHamB(Ham_TraceBleed, hitEnt, dmg, VecDir, hTrace, DMG_BULLET | DMG_NEVERGIB);
  218. make_blood(VecEnd, dmg, hitEnt);
  219. }
  220.  
  221. }
  222.  
  223. new solid = pev(hitEnt, pev_solid);
  224. if (solid != SOLID_BSP)
  225. bNeedDrawShot = false;
  226.  
  227. }
  228.  
  229. static Float:punchAngle[3];
  230. punchAngle[0] = float(random_num(-EWEAPON_VERTICAL_RECOIL, EWEAPON_VERTICAL_RECOIL)) / 100.0;
  231.  
  232. punchAngle[1] = float(random_num(-EWEAPON_HORIZONTAL_RECOIL, EWEAPON_HORIZONTAL_RECOIL)) / 100.0;
  233. punchAngle[2] = 0.0;
  234. set_pev(id, pev_punchangle, punchAngle);
  235.  
  236.  
  237. /* draw decal if needed */
  238.  
  239. if (bNeedDrawShot == true) {
  240. #if defined FIRE_WATERSPRAY
  241. #else
  242. create_shot(VecEnd, hitEnt);
  243. #endif //FIRE_WATERSPRAY
  244. } else {
  245. if (pev_valid(hitEnt)) {
  246. // engfunc(EngFunc_EmitAmbientSound, 0, VecEnd, "hit_body.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  247. }
  248. }
  249.  
  250. set_pdata_float(weapon_entity, m_flNextPrimaryAttack, EWEAPON_SHOOT_NEXTATTACKTIME, CBASEWEAPON_LINUX_XTRA_OFF)
  251. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, EWEAPON_SHOOT_NEXTIDLETIME, CBASEWEAPON_LINUX_XTRA_OFF)
  252.  
  253. free_tr2(hTrace);
  254.  
  255. return HAM_SUPERCEDE;
  256. }
  257.  
  258. public CWeapon__SetModel(entity, model[]) {
  259. if(!is_valid_ent(entity))
  260. return FMRES_IGNORED;
  261.  
  262. static szClassName[33]
  263. entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  264.  
  265. // save original W_ model
  266. if (equal(szClassName, EWEAPON_BASE_WEAPON)) {
  267. copy(g_OriginalWModel, 127, model)
  268. }
  269.  
  270.  
  271. if (!equal(szClassName, "weaponbox")) {
  272. return FMRES_IGNORED;
  273. }
  274.  
  275. if (!g_OriginalWModel[0] || !equal(g_OriginalWModel, model)) {
  276. return FMRES_IGNORED;
  277. }
  278.  
  279. new entOwner = entity_get_edict(entity, EV_ENT_owner)
  280. new entStoredEWep = find_ent_by_owner(FM_NULLENT, EWEAPON_BASE_WEAPON, entity)
  281.  
  282. if(is_user_connected(entOwner) && \
  283. g_EWepPlayerData[entOwner][wep_have] == true &&
  284. is_valid_ent(entStoredEWep)) \
  285. {
  286. entity_set_int(entStoredEWep, EV_INT_WEAPONKEY, EWEAPON_WEAPONKEY)
  287.  
  288. // save ammo
  289. new bpammos = cs_get_user_bpammo(entOwner, g_EWeaponId);
  290. entity_set_int(entStoredEWep, EV_INT_weapons, bpammos);
  291. cs_set_user_bpammo(entOwner, g_EWeaponId, 0);
  292.  
  293. CWeapon__RemoveFromPlayer(entOwner)
  294.  
  295. entity_set_model(entity, EWEAPON_W_MODEL);
  296.  
  297. return FMRES_SUPERCEDE;
  298. }
  299.  
  300. return FMRES_IGNORED;
  301. }
  302.  
  303. stock CWeapon__RemoveFromPlayer(id) {
  304. g_EWepPlayerData[id][wep_have] = false;
  305. g_EWepPlayerData[id][wep_active] = false;
  306. g_EWepPlayerData[id][wep_ent] = 0;
  307. }
  308.  
  309. public CWeapon__Deploy(weapon_entity) {
  310. if (!is_valid_ent(weapon_entity))
  311. return HAM_IGNORED;
  312.  
  313. static szClassName[33]
  314. entity_get_string(weapon_entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  315.  
  316. new i, id = 0;
  317. for (i = 1; i < (MAX_PLAYERS+1); i++) {
  318. if (g_EWepPlayerData[i][wep_have] && g_EWepPlayerData[i][wep_ent] == weapon_entity)
  319. id = i;
  320. }
  321.  
  322.  
  323. if (!is_user_connected(id))
  324. return HAM_IGNORED;
  325.  
  326. if (!g_EWepPlayerData[id][wep_have])
  327. return HAM_IGNORED;
  328.  
  329. if (!equal(szClassName, EWEAPON_BASE_WEAPON)) {
  330. g_EWepPlayerData[id][wep_active] = false;
  331. return HAM_IGNORED;
  332. }
  333.  
  334. new iClip = get_pdata_int(weapon_entity, m_iClip, CBASEWEAPON_LINUX_XTRA_OFF)
  335.  
  336. set_pev(id, pev_viewmodel2, EWEAPON_V_MODEL);
  337. set_pev(id, pev_weaponmodel2, EWEAPON_P_MODEL);
  338.  
  339. g_EWepPlayerData[id][wep_active] = true;
  340.  
  341. if (iClip > 0)
  342. send_weapon_animation(id, ANIM_DRAW)
  343. else
  344. send_weapon_animation(id, ANIM_DRAW_EMPTY)
  345.  
  346. return HAM_IGNORED;
  347. }
  348.  
  349.  
  350. public CWeapon__AttachToPlayer(weapon_entity, id) {
  351. if (!is_valid_ent(weapon_entity))
  352. return HAM_IGNORED;
  353.  
  354. if (!is_user_connected(id))
  355. return HAM_IGNORED;
  356.  
  357. if (!g_EWepPlayerData[id][wep_have])
  358. return HAM_IGNORED;
  359.  
  360. if(get_pdata_int(weapon_entity, m_fKnown, CBASEWEAPON_LINUX_XTRA_OFF)) {
  361. return HAM_IGNORED;
  362. }
  363.  
  364. set_pdata_int(weapon_entity, m_iClip, EWEAPON_CLIPSIZE, CBASEWEAPON_LINUX_XTRA_OFF)
  365.  
  366. return HAM_IGNORED;
  367. }
  368.  
  369. public CWeapon__AddToPlayer(weapon_entity, id) {
  370. if (!is_valid_ent(weapon_entity))
  371. return HAM_IGNORED;
  372.  
  373. if (!is_user_connected(id))
  374. return HAM_IGNORED;
  375.  
  376. if(entity_get_int(weapon_entity, EV_INT_WEAPONKEY) == EWEAPON_WEAPONKEY && g_EWepPlayerData[id][wep_have] == false) {
  377.  
  378. entity_set_int(weapon_entity, EV_INT_WEAPONKEY, 0)
  379.  
  380. //restore ammo
  381. new bpammos = entity_get_int(weapon_entity, EV_INT_weapons);
  382. cs_set_user_bpammo(id, g_EWeaponId, bpammos);
  383.  
  384. g_EWepPlayerData[id][wep_have] = true;
  385. g_EWepPlayerData[id][wep_ent] = weapon_entity;
  386. return HAM_HANDLED;
  387. }
  388.  
  389. if (g_EWepPlayerData[id][wep_have] == true) {
  390. g_EWepPlayerData[id][wep_ent] = weapon_entity;
  391. }
  392.  
  393. return HAM_IGNORED;
  394. }
  395.  
  396. public CWeapon__ItemPostFrame(weapon_entity) {
  397. new id = pev(weapon_entity, pev_owner)
  398. if (!is_user_connected(id))
  399. return FMRES_IGNORED;
  400.  
  401. if (!g_EWepPlayerData[id][wep_have])
  402. return FMRES_IGNORED;
  403.  
  404. new Float:flNextAttack = get_pdata_float(id, m_flNextAttack)
  405.  
  406. new iBpAmmo = cs_get_user_bpammo(id, g_EWeaponId);
  407. new iClip = get_pdata_int(weapon_entity, m_iClip)
  408.  
  409. new fInReload = get_pdata_int(weapon_entity, m_fInReload, CBASEWEAPON_LINUX_XTRA_OFF)
  410.  
  411. if (fInReload && flNextAttack <= 0.0) {
  412. new j = min(EWEAPON_CLIPSIZE - iClip, iBpAmmo)
  413.  
  414. set_pdata_int(weapon_entity, m_iClip, iClip + j, CBASEWEAPON_LINUX_XTRA_OFF)
  415. cs_set_user_bpammo(id, g_EWeaponId, iBpAmmo-j);
  416.  
  417. set_pdata_int(weapon_entity, m_fInReload, 0, CBASEWEAPON_LINUX_XTRA_OFF)
  418. fInReload = 0
  419. }
  420.  
  421. return FMRES_IGNORED;
  422. }
  423.  
  424. public CWeapon__Reload(weapon_entity) {
  425. new id = pev(weapon_entity, pev_owner)
  426. if (!is_user_connected(id))
  427. return FMRES_IGNORED;
  428.  
  429. if (!g_EWepPlayerData[id][wep_have])
  430. return FMRES_IGNORED;
  431.  
  432. g_EWepPlayerData[id][wep_TmpClip] = -1;
  433.  
  434. new iBpAmmo = cs_get_user_bpammo(id, g_EWeaponId);
  435. new iClip = get_pdata_int(weapon_entity, m_iClip, CBASEWEAPON_LINUX_XTRA_OFF)
  436.  
  437. if (iBpAmmo <= 0)
  438. return FMRES_SUPERCEDE;
  439.  
  440. if (iClip >= EWEAPON_CLIPSIZE)
  441. return FMRES_SUPERCEDE;
  442.  
  443.  
  444. g_EWepPlayerData[id][wep_TmpClip] = iClip;
  445.  
  446. set_pdata_int(weapon_entity, m_iClip, 0, CBASEWEAPON_LINUX_XTRA_OFF)
  447.  
  448. return FMRES_IGNORED;
  449. }
  450.  
  451. public CWeapon__Reload_Post(weapon_entity) {
  452. new id = pev(weapon_entity, pev_owner)
  453. if (!is_user_connected(id))
  454. return FMRES_IGNORED;
  455.  
  456. if (!g_EWepPlayerData[id][wep_have])
  457. return FMRES_IGNORED;
  458.  
  459. if (g_EWepPlayerData[id][wep_TmpClip] == -1)
  460. return FMRES_IGNORED;
  461.  
  462. set_pdata_int(weapon_entity, m_iClip, g_EWepPlayerData[id][wep_TmpClip], CBASEWEAPON_LINUX_XTRA_OFF)
  463.  
  464. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, EWEAPON_RELOAD_TIME, CBASEWEAPON_LINUX_XTRA_OFF)
  465.  
  466. set_pdata_float(id, m_flNextAttack, EWEAPON_RELOAD_TIME)
  467.  
  468. set_pdata_int(weapon_entity, m_fInReload, 1)
  469.  
  470. send_weapon_animation( id, ANIM_RELOAD )
  471.  
  472. g_EWepPlayerData[id][wep_TmpClip] = -1;
  473.  
  474. return FMRES_IGNORED;
  475. }
  476.  
  477. public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle) {
  478. if(!is_user_alive(Player))
  479. return FMRES_IGNORED;
  480.  
  481. if(!g_EWepPlayerData[Player][wep_active])
  482. return FMRES_IGNORED;
  483.  
  484. set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  485. return FMRES_HANDLED
  486. }
  487.  
  488. public event_curweapon(id) {
  489. if(!is_user_alive(id))
  490. return PLUGIN_CONTINUE;
  491.  
  492. if(read_data(2) == g_EWeaponId && g_EWepPlayerData[id][wep_have] == true) {
  493. } else {
  494. g_EWepPlayerData[id][wep_active] = false;
  495. }
  496. return PLUGIN_HANDLED;
  497. }
  498.  
  499. public client_connect(id) {
  500. g_EWepPlayerData[id][wep_active] = false;
  501. g_EWepPlayerData[id][wep_have] = false;
  502. }
  503.  
  504. public client_disconnect(id) {
  505. if (g_EWepPlayerData[id][wep_have] == true) {
  506. CWeapon__RemoveFromPlayer(id)
  507. }
  508. }
  509.  
  510. public message_DeathMsg(msg_id, msg_dest, id) {
  511. static szTruncatedWeapon[33], iAttacker;
  512.  
  513. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon));
  514.  
  515. iAttacker = get_msg_arg_int(1);
  516.  
  517. if(is_user_connected(iAttacker) && g_EWepPlayerData[iAttacker][wep_have] == true && equal(szTruncatedWeapon, EWEAPON_BASE_WEAPON)) {
  518. set_msg_arg_string(4, EWEAPON_LOGNAME);
  519. }
  520.  
  521. return PLUGIN_CONTINUE;
  522. }
  523.  
  524. #if defined FIRE_WATERSPRAY
  525. stock create_tracer_water(id, Float:fVec1[3], Float:fVec2[3]) {
  526. static iVec1[3];
  527. FVecIVec(fVec1, iVec1);
  528.  
  529. static Float:origin[3], Float:vSrc[3], Float:angles[3], Float:v_forward[3], Float:v_right[3], Float:v_up[3], Float:gun_position[3], Float:player_origin[3], Float:player_view_offset[3];
  530. pev(id, pev_v_angle, angles);
  531. engfunc(EngFunc_MakeVectors, angles);
  532. global_get(glb_v_forward, v_forward);
  533. global_get(glb_v_right, v_right);
  534. global_get(glb_v_up, v_up);
  535.  
  536. //m_pPlayer->GetGunPosition( ) = pev->origin + pev->view_ofs
  537. pev(id, pev_origin, player_origin);
  538. pev(id, pev_view_ofs, player_view_offset);
  539. xs_vec_add(player_origin, player_view_offset, gun_position);
  540.  
  541. xs_vec_mul_scalar(v_forward, 24.0, v_forward);
  542. xs_vec_mul_scalar(v_right, 3.0, v_right);
  543.  
  544. if ((pev(id, pev_flags) & FL_DUCKING) == FL_DUCKING)
  545. xs_vec_mul_scalar(v_up, 6.0, v_up);
  546. else
  547. xs_vec_mul_scalar(v_up, -2.0, v_up);
  548.  
  549. xs_vec_add(gun_position, v_forward, origin);
  550. xs_vec_add(origin, v_right, origin);
  551. xs_vec_add(origin, v_up, origin);
  552.  
  553. vSrc[0] = origin[0];
  554. vSrc[1] = origin[1];
  555. vSrc[2] = origin[2];
  556.  
  557.  
  558. new Float:dist = get_distance_f(vSrc, fVec2);
  559. new CountDrops = floatround(dist / 50.0);
  560.  
  561. if (CountDrops > 20)
  562. CountDrops = 20;
  563.  
  564. if (CountDrops < 2)
  565. CountDrops = 2;
  566.  
  567. message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1);
  568. write_byte(TE_SPRITETRAIL);
  569. engfunc(EngFunc_WriteCoord, vSrc[0]);
  570. engfunc(EngFunc_WriteCoord, vSrc[1]);
  571. engfunc(EngFunc_WriteCoord, vSrc[2]);
  572. engfunc(EngFunc_WriteCoord, fVec2[0]);
  573. engfunc(EngFunc_WriteCoord, fVec2[1]);
  574. engfunc(EngFunc_WriteCoord, fVec2[2]);
  575. write_short(tracer_sprite2);
  576. write_byte(CountDrops); //count
  577. write_byte(0); //life
  578. write_byte(1); //scale
  579. write_byte(60); //velocity
  580. write_byte(10); //rand_velocity
  581. message_end();
  582.  
  583.  
  584. message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1);
  585. write_byte(TE_BEAMPOINTS);
  586. engfunc(EngFunc_WriteCoord, fVec2[0]);
  587. engfunc(EngFunc_WriteCoord, fVec2[1]);
  588. engfunc(EngFunc_WriteCoord, fVec2[2]);
  589. engfunc(EngFunc_WriteCoord, vSrc[0]);
  590. engfunc(EngFunc_WriteCoord, vSrc[1]);
  591. engfunc(EngFunc_WriteCoord, vSrc[2]);
  592. write_short(tracer_sprite);
  593. write_byte(6); //starting_frame
  594. write_byte(200); //framerate
  595. write_byte(1); //life
  596. write_byte(100); //line width
  597. write_byte(0); //noise ampl
  598. write_byte(64); write_byte(64); write_byte(192); //color
  599. write_byte(192); //brightness
  600. write_byte(250); //scroll speed
  601. message_end();
  602. }
  603. #endif //FIRE_WATERSPRAY
  604.  
  605. stock send_weapon_animation(id, iAnim) {
  606. set_pev(id, pev_weaponanim, iAnim);
  607. message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
  608. write_byte(iAnim);
  609. write_byte(pev(id,pev_body));
  610. message_end();
  611. }
  612.  
  613. stock create_shot(Float:fOrigin[3], entity = 0) {
  614. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  615. write_byte(TE_GUNSHOTDECAL);
  616. engfunc(EngFunc_WriteCoord, fOrigin[0]);
  617. engfunc(EngFunc_WriteCoord, fOrigin[1]);
  618. engfunc(EngFunc_WriteCoord, fOrigin[2]);
  619. if(!pev_valid(entity)) {
  620. write_short(0);
  621. } else {
  622. write_short(entity);
  623. }
  624. write_byte(DecalsShot[random_num(0,4)]);
  625. message_end();
  626. }
  627.  
  628. stock make_blood(const Float:vTraceEnd[3], Float:Damage, hitEnt) {
  629. new bloodColor = ExecuteHam(Ham_BloodColor, hitEnt);
  630. if (bloodColor == -1)
  631. return;
  632.  
  633. new amount = floatround(Damage);
  634.  
  635. amount *= 2; //according to HLSDK
  636.  
  637. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  638. write_byte(TE_BLOODSPRITE);
  639. write_coord(floatround(vTraceEnd[0]));
  640. write_coord(floatround(vTraceEnd[1]));
  641. write_coord(floatround(vTraceEnd[2]));
  642. write_short(g_BloodSprite[1]);
  643. write_short(g_BloodSprite[0]);
  644. write_byte(bloodColor);
  645. write_byte(min(max(3, amount/10), 16));
  646. message_end();
  647. }
  648.  
  649. public zp_extra_item_selected(id, itemid) {
  650. if(itemid == g_itemid_guitar) {
  651. if (user_has_weapon(id, g_EWeaponId))
  652. engclient_cmd(id, "drop", EWEAPON_BASE_WEAPON);
  653.  
  654. g_EWepPlayerData[id][wep_have] = true;
  655. give_item(id, EWEAPON_BASE_WEAPON);
  656.  
  657. cs_set_user_bpammo (id, g_EWeaponId, EWEAPON_START_AMMO);
  658. }
  659. }
  660.  
  661. public zp_user_infected_post(id) {
  662. if (g_EWepPlayerData[id][wep_have] == true) {
  663. CWeapon__RemoveFromPlayer(id)
  664. }
  665. }
  666.  
  667. public zp_user_humanized_post(id, survivor) {
  668. if (survivor && g_EWepPlayerData[id][wep_have] == true) {
  669. CWeapon__RemoveFromPlayer(id)
  670. }
  671. }
  672.  
  673. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  674. *{\\ rtf1\\ ansi\\ ansicpg1250\\ deff0\\ deflang1051{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
  675. */
  676.  


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: CSO Dual Balrog segítség
HozzászólásElküldve: 2013.04.05. 17:31 
Offline
Jómunkásember

Csatlakozott: 2012.01.29. 12:48
Hozzászólások: 408
Megköszönt másnak: 15 alkalommal
Megköszönték neki: 126 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <fakemeta_util>
  5. #include <hamsandwich>
  6. #include <fun>
  7. #include <engine>
  8. #include <cstrike>
  9. #include <zombieplague>
  10. #define EWEAPON_W_MODEL "models/cso_wpn/w_balrog3.mdl"
  11. #define EWEAPON_V_MODEL "models/cso_wpn/v_balrog3.mdl"
  12. #define EWEAPON_P_MODEL "models/cso_wpn/p_balrog3.mdl"
  13. #define EWEAPON_SOUND_FIRE "weapons/cso/balrog3_shoot.wav"
  14. #define EWEAPON_SOUND_EMPTY "weapons/ak47_clipout.wav"
  15. #define EWEAPON_SOUND_DRAW "weapons/cso/balrog3_draw.wav"
  16.  
  17. #define EWEAPON_LOGNAME "Dual Balrog"
  18.  
  19. #define EWEAPON_WEAPONKEY 1200788
  20. #define EWEAPON_BASE_WEAPON "weapon_ump45"
  21.  
  22. #define EWEAPON_CLIPSIZE 50
  23. #define EWEAPON_START_AMMO 300
  24.  
  25. #define EWEAPON_SHOOT_NEXTATTACKTIME 0.1
  26. #define EWEAPON_SHOOT_NEXTIDLETIME 0.1
  27. #define EWEAPON_SHOOTEMPTY_NEXTATTACKTIME 0.2
  28. #define EWEAPON_SHOOTEMPTY_NEXTIDLETIME 0.2
  29. #define EWEAPON_RELOAD_TIME 2.3
  30. #define EWEAPON_BASE_DAMAGE 100.0
  31.  
  32. #define EWEAPON_HORIZONTAL_RECOIL 150
  33. #define EWEAPON_VERTICAL_RECOIL 1
  34.  
  35. #define ANIM_IDLE 0
  36. #define ANIM_IDLE_EMPTY 3
  37. #define ANIM_RELOAD 4
  38. #define ANIM_DRAW 5
  39. #define ANIM_DRAW_EMPTY 2
  40. #define ANIM_FIRE1 1
  41. #define ANIM_FIRE2 1
  42. #define ANIM_FIRE3 1
  43.  
  44. #define ANIM_PLAYER_POSTFIX "rifle"
  45.  
  46. /* ------------------------------------------------- */
  47.  
  48. new g_EWeaponId = 0;
  49. new g_OriginalWModel[128];
  50. #define EV_INT_WEAPONKEY EV_INT_impulse
  51. #define MAX_PLAYERS 32
  52.  
  53. new DecalsShot[5] = {41, 42, 43, 44, 45};
  54. new g_BloodDecals[6];
  55. new g_BloodSprite[2];
  56.  
  57. enum _:e_EWepState
  58. {
  59. bool:wep_have,
  60. bool:wep_active,
  61. wep_ent,
  62. wep_TmpClip,
  63. };
  64.  
  65. new g_EWepPlayerData[MAX_PLAYERS+1][e_EWepState];
  66.  
  67. //CBaseWeapon fields
  68. #define m_fKnown 44
  69. #define m_flNextPrimaryAttack 46
  70. #define m_flTimeWeaponIdle 48
  71. #define m_iClip 51
  72. #define m_fInReload 54
  73. #define m_flNextAttack 83
  74. #define CBASEWEAPON_LINUX_XTRA_OFF 4
  75.  
  76. new const g_item_name[] = { "\wDual Balrog\r[CSO]" };
  77. new g_itemid_guitar;
  78. const g_item_cost = 18;
  79.  
  80. #if defined FIRE_WATERSPRAY
  81. new tracer_sprite;
  82. new tracer_sprite2;
  83. #endif //FIRE_WATERSPRAY
  84.  
  85. public plugin_init() {
  86. register_plugin("[ZP] Extra: Guitar!", "0.7.0", "Crock");
  87. g_itemid_guitar = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN);
  88.  
  89. InitDecals();
  90.  
  91. RegisterHam(Ham_Weapon_PrimaryAttack, EWEAPON_BASE_WEAPON, "CWeapon__PrimaryAttack");
  92. RegisterHam(Ham_Item_Deploy, EWEAPON_BASE_WEAPON, "CWeapon__Deploy", 1);
  93. RegisterHam(Ham_Item_AddToPlayer, EWEAPON_BASE_WEAPON, "CWeapon__AddToPlayer");
  94. RegisterHam(Ham_Item_AttachToPlayer, EWEAPON_BASE_WEAPON, "CWeapon__AttachToPlayer");
  95. RegisterHam(Ham_Item_PostFrame, EWEAPON_BASE_WEAPON, "CWeapon__ItemPostFrame");
  96. RegisterHam(Ham_Weapon_Reload, EWEAPON_BASE_WEAPON, "CWeapon__Reload");
  97. RegisterHam(Ham_Weapon_Reload, EWEAPON_BASE_WEAPON, "CWeapon__Reload_Post", 1);
  98.  
  99. register_forward(FM_SetModel, "CWeapon__SetModel");
  100. register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1);
  101. register_event("CurWeapon", "event_curweapon", "be", "1=1");
  102. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
  103.  
  104. g_EWeaponId = get_weaponid(EWEAPON_BASE_WEAPON);
  105. }
  106.  
  107. stock InitDecals()
  108. {
  109. g_BloodDecals[0] = get_decal_index("{blood1");
  110. g_BloodDecals[1] = get_decal_index("{blood2");
  111. g_BloodDecals[2] = get_decal_index("{blood3");
  112. g_BloodDecals[3] = get_decal_index("{blood4");
  113. g_BloodDecals[4] = get_decal_index("{blood5");
  114. g_BloodDecals[5] = get_decal_index("{blood6");
  115. }
  116.  
  117. public plugin_precache() {
  118. precache_model(EWEAPON_V_MODEL)
  119. precache_model(EWEAPON_P_MODEL)
  120. precache_model(EWEAPON_W_MODEL)
  121.  
  122. precache_sound(EWEAPON_SOUND_FIRE);
  123. precache_sound(EWEAPON_SOUND_EMPTY);
  124. precache_sound(EWEAPON_SOUND_DRAW);
  125. }
  126.  
  127. public CWeapon__PrimaryAttack(weapon_entity) {
  128. if(!is_valid_ent(weapon_entity))
  129. return HAM_IGNORED;
  130.  
  131. new id = pev(weapon_entity, pev_owner)
  132. if (!is_user_connected(id))
  133. return HAM_IGNORED;
  134.  
  135. if (!g_EWepPlayerData[id][wep_have])
  136. return HAM_IGNORED;
  137.  
  138. static szClassName[33]
  139. entity_get_string(weapon_entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  140.  
  141. new iClip = get_pdata_int(weapon_entity, m_iClip, CBASEWEAPON_LINUX_XTRA_OFF)
  142. if (iClip <= 0) {
  143. send_weapon_animation(id, ANIM_IDLE_EMPTY)
  144. engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, EWEAPON_SOUND_EMPTY, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  145.  
  146. set_pdata_float(weapon_entity, m_flNextPrimaryAttack, EWEAPON_SHOOTEMPTY_NEXTATTACKTIME, CBASEWEAPON_LINUX_XTRA_OFF)
  147. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, EWEAPON_SHOOTEMPTY_NEXTIDLETIME, CBASEWEAPON_LINUX_XTRA_OFF)
  148.  
  149. return HAM_SUPERCEDE;
  150. }
  151. iClip--;
  152. set_pdata_int(weapon_entity, m_iClip, iClip, CBASEWEAPON_LINUX_XTRA_OFF);
  153.  
  154. new anim;
  155. switch (random_num(0,2)) {
  156. case 0: anim = ANIM_FIRE1;
  157. case 1: anim = ANIM_FIRE2;
  158. default: anim = ANIM_FIRE3;
  159. }
  160. send_weapon_animation(id, anim);
  161.  
  162.  
  163. /* player model animation */
  164.  
  165. engfunc(EngFunc_EmitSound, id, CHAN_WEAPON, EWEAPON_SOUND_FIRE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  166.  
  167.  
  168. static Float:plrViewAngles[3], Float:VecEnd[3], Float:VecDir[3], Float:PlrOrigin[3];
  169. pev(id, pev_v_angle, plrViewAngles);
  170.  
  171. static Float:VecSrc[3], Float:VecDst[3];
  172.  
  173. //VecSrc = pev->origin + pev->view_ofs;
  174. pev(id, pev_origin, PlrOrigin)
  175. pev(id, pev_view_ofs, VecSrc)
  176. xs_vec_add(VecSrc, PlrOrigin, VecSrc)
  177.  
  178. //VecDst = VecDir * 8192.0;
  179. angle_vector(plrViewAngles, ANGLEVECTOR_FORWARD, VecDir);
  180. xs_vec_mul_scalar(VecDir, 8192.0, VecDst);
  181. xs_vec_add(VecDst, VecSrc, VecDst);
  182.  
  183. new hTrace = create_tr2()
  184. engfunc(EngFunc_TraceLine, VecSrc, VecDst, 0, id, hTrace)
  185. new hitEnt = get_tr2(hTrace, TR_pHit);
  186. get_tr2(hTrace, TR_vecEndPos, VecEnd);
  187.  
  188. #if defined FIRE_WATERSPRAY
  189. create_tracer_water(id, VecSrc, VecEnd)
  190. #endif //FIRE_WATERSPRAY
  191.  
  192. new bool:bNeedDrawShot = true;
  193.  
  194. if (pev_valid(hitEnt)) {
  195. new Float:takeDamage;
  196. pev(hitEnt, pev_takedamage, takeDamage);
  197.  
  198. if (takeDamage != 0.0) {
  199. bNeedDrawShot = false;
  200.  
  201. new Float:dmg = EWEAPON_BASE_DAMAGE;
  202.  
  203. new hitGroup = get_tr2(hTrace, TR_iHitgroup);
  204.  
  205. switch (hitGroup) {
  206. case HIT_HEAD: { dmg *= 1.0; }
  207. case HIT_LEFTARM: { dmg *= 0.5; }
  208. case HIT_RIGHTARM: { dmg *= 0.5; }
  209. case HIT_LEFTLEG: { dmg *= 0.5; }
  210. case HIT_RIGHTLEG: { dmg *= 0.5; }
  211. }
  212.  
  213. if (is_user_connected(hitEnt) && zp_get_user_zombie(hitEnt)) {
  214. ExecuteHamB(Ham_TakeDamage, hitEnt, id, id, dmg, DMG_BULLET | DMG_NEVERGIB);
  215. ExecuteHamB(Ham_TraceBleed, hitEnt, dmg, VecDir, hTrace, DMG_BULLET | DMG_NEVERGIB);
  216. make_blood(VecEnd, dmg, hitEnt);
  217. }
  218.  
  219. }
  220.  
  221. new solid = pev(hitEnt, pev_solid);
  222. if (solid != SOLID_BSP)
  223. bNeedDrawShot = false;
  224.  
  225. }
  226.  
  227. static Float:punchAngle[3];
  228. punchAngle[0] = float(random_num(-EWEAPON_VERTICAL_RECOIL, EWEAPON_VERTICAL_RECOIL)) / 100.0;
  229.  
  230. punchAngle[1] = float(random_num(-EWEAPON_HORIZONTAL_RECOIL, EWEAPON_HORIZONTAL_RECOIL)) / 100.0;
  231. punchAngle[2] = 0.0;
  232. set_pev(id, pev_punchangle, punchAngle);
  233.  
  234.  
  235. /* draw decal if needed */
  236.  
  237. if (bNeedDrawShot == true) {
  238. #if defined FIRE_WATERSPRAY
  239. #else
  240. create_shot(VecEnd, hitEnt);
  241. #endif //FIRE_WATERSPRAY
  242. } else {
  243. if (pev_valid(hitEnt)) {
  244. // engfunc(EngFunc_EmitAmbientSound, 0, VecEnd, "hit_body.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  245. }
  246. }
  247.  
  248. set_pdata_float(weapon_entity, m_flNextPrimaryAttack, EWEAPON_SHOOT_NEXTATTACKTIME, CBASEWEAPON_LINUX_XTRA_OFF)
  249. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, EWEAPON_SHOOT_NEXTIDLETIME, CBASEWEAPON_LINUX_XTRA_OFF)
  250.  
  251. free_tr2(hTrace);
  252.  
  253. return HAM_SUPERCEDE;
  254. }
  255.  
  256. public CWeapon__SetModel(entity, model[]) {
  257. if(!is_valid_ent(entity))
  258. return FMRES_IGNORED;
  259.  
  260. static szClassName[33]
  261. entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  262.  
  263. // save original W_ model
  264. if (equal(szClassName, EWEAPON_BASE_WEAPON)) {
  265. copy(g_OriginalWModel, 127, model)
  266. }
  267.  
  268.  
  269. if (!equal(szClassName, "weaponbox")) {
  270. return FMRES_IGNORED;
  271. }
  272.  
  273. if (!g_OriginalWModel[0] || !equal(g_OriginalWModel, model)) {
  274. return FMRES_IGNORED;
  275. }
  276.  
  277. new entOwner = entity_get_edict(entity, EV_ENT_owner)
  278. new entStoredEWep = find_ent_by_owner(FM_NULLENT, EWEAPON_BASE_WEAPON, entity)
  279.  
  280. if(is_user_connected(entOwner) && \
  281. g_EWepPlayerData[entOwner][wep_have] == true &&
  282. is_valid_ent(entStoredEWep)) \
  283. {
  284. entity_set_int(entStoredEWep, EV_INT_WEAPONKEY, EWEAPON_WEAPONKEY)
  285.  
  286. // save ammo
  287. new bpammos = cs_get_user_bpammo(entOwner, g_EWeaponId);
  288. entity_set_int(entStoredEWep, EV_INT_weapons, bpammos);
  289. cs_set_user_bpammo(entOwner, g_EWeaponId, 0);
  290.  
  291. CWeapon__RemoveFromPlayer(entOwner)
  292.  
  293. entity_set_model(entity, EWEAPON_W_MODEL);
  294.  
  295. return FMRES_SUPERCEDE;
  296. }
  297.  
  298. return FMRES_IGNORED;
  299. }
  300.  
  301. stock CWeapon__RemoveFromPlayer(id) {
  302. g_EWepPlayerData[id][wep_have] = false;
  303. g_EWepPlayerData[id][wep_active] = false;
  304. g_EWepPlayerData[id][wep_ent] = 0;
  305. }
  306.  
  307. public CWeapon__Deploy(weapon_entity) {
  308. if (!is_valid_ent(weapon_entity))
  309. return HAM_IGNORED;
  310.  
  311. static szClassName[33]
  312. entity_get_string(weapon_entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  313.  
  314. new i, id = 0;
  315. for (i = 1; i < (MAX_PLAYERS+1); i++) {
  316. if (g_EWepPlayerData[i][wep_have] && g_EWepPlayerData[i][wep_ent] == weapon_entity)
  317. id = i;
  318. }
  319.  
  320.  
  321. if (!is_user_connected(id))
  322. return HAM_IGNORED;
  323.  
  324. if (!g_EWepPlayerData[id][wep_have])
  325. return HAM_IGNORED;
  326.  
  327. if (!equal(szClassName, EWEAPON_BASE_WEAPON)) {
  328. g_EWepPlayerData[id][wep_active] = false;
  329. return HAM_IGNORED;
  330. }
  331.  
  332. new iClip = get_pdata_int(weapon_entity, m_iClip, CBASEWEAPON_LINUX_XTRA_OFF)
  333.  
  334. set_pev(id, pev_viewmodel2, EWEAPON_V_MODEL);
  335. set_pev(id, pev_weaponmodel2, EWEAPON_P_MODEL);
  336.  
  337. g_EWepPlayerData[id][wep_active] = true;
  338.  
  339. if (iClip > 0)
  340. send_weapon_animation(id, ANIM_DRAW)
  341. else
  342. send_weapon_animation(id, ANIM_DRAW_EMPTY)
  343.  
  344. return HAM_IGNORED;
  345. }
  346.  
  347.  
  348. public CWeapon__AttachToPlayer(weapon_entity, id) {
  349. if (!is_valid_ent(weapon_entity))
  350. return HAM_IGNORED;
  351.  
  352. if (!is_user_connected(id))
  353. return HAM_IGNORED;
  354.  
  355. if (!g_EWepPlayerData[id][wep_have])
  356. return HAM_IGNORED;
  357.  
  358. if(get_pdata_int(weapon_entity, m_fKnown, CBASEWEAPON_LINUX_XTRA_OFF)) {
  359. return HAM_IGNORED;
  360. }
  361.  
  362. set_pdata_int(weapon_entity, m_iClip, EWEAPON_CLIPSIZE, CBASEWEAPON_LINUX_XTRA_OFF)
  363.  
  364. return HAM_IGNORED;
  365. }
  366.  
  367. public CWeapon__AddToPlayer(weapon_entity, id) {
  368. if (!is_valid_ent(weapon_entity))
  369. return HAM_IGNORED;
  370.  
  371. if (!is_user_connected(id))
  372. return HAM_IGNORED;
  373.  
  374. if(entity_get_int(weapon_entity, EV_INT_WEAPONKEY) == EWEAPON_WEAPONKEY && g_EWepPlayerData[id][wep_have] == false) {
  375.  
  376. entity_set_int(weapon_entity, EV_INT_WEAPONKEY, 0)
  377.  
  378. //restore ammo
  379. new bpammos = entity_get_int(weapon_entity, EV_INT_weapons);
  380. cs_set_user_bpammo(id, g_EWeaponId, bpammos);
  381.  
  382. g_EWepPlayerData[id][wep_have] = true;
  383. g_EWepPlayerData[id][wep_ent] = weapon_entity;
  384. return HAM_HANDLED;
  385. }
  386.  
  387. if (g_EWepPlayerData[id][wep_have] == true) {
  388. g_EWepPlayerData[id][wep_ent] = weapon_entity;
  389. }
  390.  
  391. return HAM_IGNORED;
  392. }
  393.  
  394. public CWeapon__ItemPostFrame(weapon_entity) {
  395. new id = pev(weapon_entity, pev_owner)
  396. if (!is_user_connected(id))
  397. return FMRES_IGNORED;
  398.  
  399. if (!g_EWepPlayerData[id][wep_have])
  400. return FMRES_IGNORED;
  401.  
  402. new Float:flNextAttack = get_pdata_float(id, m_flNextAttack)
  403.  
  404. new iBpAmmo = cs_get_user_bpammo(id, g_EWeaponId);
  405. new iClip = get_pdata_int(weapon_entity, m_iClip)
  406.  
  407. new fInReload = get_pdata_int(weapon_entity, m_fInReload, CBASEWEAPON_LINUX_XTRA_OFF)
  408.  
  409. if (fInReload && flNextAttack <= 0.0) {
  410. new j = min(EWEAPON_CLIPSIZE - iClip, iBpAmmo)
  411.  
  412. set_pdata_int(weapon_entity, m_iClip, iClip + j, CBASEWEAPON_LINUX_XTRA_OFF)
  413. cs_set_user_bpammo(id, g_EWeaponId, iBpAmmo-j);
  414.  
  415. set_pdata_int(weapon_entity, m_fInReload, 0, CBASEWEAPON_LINUX_XTRA_OFF)
  416. fInReload = 0
  417. }
  418.  
  419. return FMRES_IGNORED;
  420. }
  421.  
  422. public CWeapon__Reload(weapon_entity) {
  423. new id = pev(weapon_entity, pev_owner)
  424. if (!is_user_connected(id))
  425. return FMRES_IGNORED;
  426.  
  427. if (!g_EWepPlayerData[id][wep_have])
  428. return FMRES_IGNORED;
  429.  
  430. g_EWepPlayerData[id][wep_TmpClip] = -1;
  431.  
  432. new iBpAmmo = cs_get_user_bpammo(id, g_EWeaponId);
  433. new iClip = get_pdata_int(weapon_entity, m_iClip, CBASEWEAPON_LINUX_XTRA_OFF)
  434.  
  435. if (iBpAmmo <= 0)
  436. return FMRES_SUPERCEDE;
  437.  
  438. if (iClip >= EWEAPON_CLIPSIZE)
  439. return FMRES_SUPERCEDE;
  440.  
  441.  
  442. g_EWepPlayerData[id][wep_TmpClip] = iClip;
  443.  
  444. set_pdata_int(weapon_entity, m_iClip, 0, CBASEWEAPON_LINUX_XTRA_OFF)
  445.  
  446. return FMRES_IGNORED;
  447. }
  448.  
  449. public CWeapon__Reload_Post(weapon_entity) {
  450. new id = pev(weapon_entity, pev_owner)
  451. if (!is_user_connected(id))
  452. return FMRES_IGNORED;
  453.  
  454. if (!g_EWepPlayerData[id][wep_have])
  455. return FMRES_IGNORED;
  456.  
  457. if (g_EWepPlayerData[id][wep_TmpClip] == -1)
  458. return FMRES_IGNORED;
  459.  
  460. set_pdata_int(weapon_entity, m_iClip, g_EWepPlayerData[id][wep_TmpClip], CBASEWEAPON_LINUX_XTRA_OFF)
  461.  
  462. set_pdata_float(weapon_entity, m_flTimeWeaponIdle, EWEAPON_RELOAD_TIME, CBASEWEAPON_LINUX_XTRA_OFF)
  463.  
  464. set_pdata_float(id, m_flNextAttack, EWEAPON_RELOAD_TIME)
  465.  
  466. set_pdata_int(weapon_entity, m_fInReload, 1)
  467.  
  468. send_weapon_animation( id, ANIM_RELOAD )
  469.  
  470. g_EWepPlayerData[id][wep_TmpClip] = -1;
  471.  
  472. return FMRES_IGNORED;
  473. }
  474.  
  475. public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle) {
  476. if(!is_user_alive(Player))
  477. return FMRES_IGNORED;
  478.  
  479. if(!g_EWepPlayerData[Player][wep_active])
  480. return FMRES_IGNORED;
  481.  
  482. set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
  483. return FMRES_HANDLED
  484. }
  485.  
  486. public event_curweapon(id) {
  487. if(!is_user_alive(id))
  488. return PLUGIN_CONTINUE;
  489.  
  490. if(read_data(2) == g_EWeaponId && g_EWepPlayerData[id][wep_have] == true) {
  491. } else {
  492. g_EWepPlayerData[id][wep_active] = false;
  493. }
  494. return PLUGIN_HANDLED;
  495. }
  496.  
  497. public client_connect(id) {
  498. g_EWepPlayerData[id][wep_active] = false;
  499. g_EWepPlayerData[id][wep_have] = false;
  500. }
  501.  
  502. public client_disconnect(id) {
  503. if (g_EWepPlayerData[id][wep_have] == true) {
  504. CWeapon__RemoveFromPlayer(id)
  505. }
  506. }
  507.  
  508. public message_DeathMsg(msg_id, msg_dest, id) {
  509. static szTruncatedWeapon[33], iAttacker;
  510.  
  511. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon));
  512.  
  513. iAttacker = get_msg_arg_int(1);
  514.  
  515. if(is_user_connected(iAttacker) && g_EWepPlayerData[iAttacker][wep_have] == true && equal(szTruncatedWeapon, EWEAPON_BASE_WEAPON)) {
  516. set_msg_arg_string(4, EWEAPON_LOGNAME);
  517. }
  518.  
  519. return PLUGIN_CONTINUE;
  520. }
  521.  
  522. #if defined FIRE_WATERSPRAY
  523. stock create_tracer_water(id, Float:fVec1[3], Float:fVec2[3]) {
  524. static iVec1[3];
  525. FVecIVec(fVec1, iVec1);
  526.  
  527. static Float:origin[3], Float:vSrc[3], Float:angles[3], Float:v_forward[3], Float:v_right[3], Float:v_up[3], Float:gun_position[3], Float:player_origin[3], Float:player_view_offset[3];
  528. pev(id, pev_v_angle, angles);
  529. engfunc(EngFunc_MakeVectors, angles);
  530. global_get(glb_v_forward, v_forward);
  531. global_get(glb_v_right, v_right);
  532. global_get(glb_v_up, v_up);
  533.  
  534. //m_pPlayer->GetGunPosition( ) = pev->origin + pev->view_ofs
  535. pev(id, pev_origin, player_origin);
  536. pev(id, pev_view_ofs, player_view_offset);
  537. xs_vec_add(player_origin, player_view_offset, gun_position);
  538.  
  539. xs_vec_mul_scalar(v_forward, 24.0, v_forward);
  540. xs_vec_mul_scalar(v_right, 3.0, v_right);
  541.  
  542. if ((pev(id, pev_flags) & FL_DUCKING) == FL_DUCKING)
  543. xs_vec_mul_scalar(v_up, 6.0, v_up);
  544. else
  545. xs_vec_mul_scalar(v_up, -2.0, v_up);
  546.  
  547. xs_vec_add(gun_position, v_forward, origin);
  548. xs_vec_add(origin, v_right, origin);
  549. xs_vec_add(origin, v_up, origin);
  550.  
  551. vSrc[0] = origin[0];
  552. vSrc[1] = origin[1];
  553. vSrc[2] = origin[2];
  554.  
  555.  
  556. new Float:dist = get_distance_f(vSrc, fVec2);
  557. new CountDrops = floatround(dist / 50.0);
  558.  
  559. if (CountDrops > 20)
  560. CountDrops = 20;
  561.  
  562. if (CountDrops < 2)
  563. CountDrops = 2;
  564.  
  565. message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1);
  566. write_byte(TE_SPRITETRAIL);
  567. engfunc(EngFunc_WriteCoord, vSrc[0]);
  568. engfunc(EngFunc_WriteCoord, vSrc[1]);
  569. engfunc(EngFunc_WriteCoord, vSrc[2]);
  570. engfunc(EngFunc_WriteCoord, fVec2[0]);
  571. engfunc(EngFunc_WriteCoord, fVec2[1]);
  572. engfunc(EngFunc_WriteCoord, fVec2[2]);
  573. write_short(tracer_sprite2);
  574. write_byte(CountDrops); //count
  575. write_byte(0); //life
  576. write_byte(1); //scale
  577. write_byte(60); //velocity
  578. write_byte(10); //rand_velocity
  579. message_end();
  580.  
  581.  
  582. message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1);
  583. write_byte(TE_BEAMPOINTS);
  584. engfunc(EngFunc_WriteCoord, fVec2[0]);
  585. engfunc(EngFunc_WriteCoord, fVec2[1]);
  586. engfunc(EngFunc_WriteCoord, fVec2[2]);
  587. engfunc(EngFunc_WriteCoord, vSrc[0]);
  588. engfunc(EngFunc_WriteCoord, vSrc[1]);
  589. engfunc(EngFunc_WriteCoord, vSrc[2]);
  590. write_short(tracer_sprite);
  591. write_byte(6); //starting_frame
  592. write_byte(200); //framerate
  593. write_byte(1); //life
  594. write_byte(100); //line width
  595. write_byte(0); //noise ampl
  596. write_byte(64); write_byte(64); write_byte(192); //color
  597. write_byte(192); //brightness
  598. write_byte(250); //scroll speed
  599. message_end();
  600. }
  601. #endif //FIRE_WATERSPRAY
  602.  
  603. stock send_weapon_animation(id, iAnim) {
  604. set_pev(id, pev_weaponanim, iAnim);
  605. message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
  606. write_byte(iAnim);
  607. write_byte(pev(id,pev_body));
  608. message_end();
  609. }
  610.  
  611. stock create_shot(Float:fOrigin[3], entity = 0) {
  612. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  613. write_byte(TE_GUNSHOTDECAL);
  614. engfunc(EngFunc_WriteCoord, fOrigin[0]);
  615. engfunc(EngFunc_WriteCoord, fOrigin[1]);
  616. engfunc(EngFunc_WriteCoord, fOrigin[2]);
  617. if(!pev_valid(entity)) {
  618. write_short(0);
  619. } else {
  620. write_short(entity);
  621. }
  622. write_byte(DecalsShot[random_num(0,4)]);
  623. message_end();
  624. }
  625.  
  626. stock make_blood(const Float:vTraceEnd[3], Float:Damage, hitEnt) {
  627. new bloodColor = ExecuteHam(Ham_BloodColor, hitEnt);
  628. if (bloodColor == -1)
  629. return;
  630.  
  631. new amount = floatround(Damage);
  632.  
  633. amount *= 2; //according to HLSDK
  634.  
  635. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  636. write_byte(TE_BLOODSPRITE);
  637. write_coord(floatround(vTraceEnd[0]));
  638. write_coord(floatround(vTraceEnd[1]));
  639. write_coord(floatround(vTraceEnd[2]));
  640. write_short(g_BloodSprite[1]);
  641. write_short(g_BloodSprite[0]);
  642. write_byte(bloodColor);
  643. write_byte(min(max(3, amount/10), 16));
  644. message_end();
  645. }
  646.  
  647. public zp_extra_item_selected(id, itemid) {
  648. if(itemid == g_itemid_guitar) {
  649. if (user_has_weapon(id, g_EWeaponId))
  650. engclient_cmd(id, "drop", EWEAPON_BASE_WEAPON);
  651.  
  652. g_EWepPlayerData[id][wep_have] = true;
  653. give_item(id, EWEAPON_BASE_WEAPON);
  654.  
  655. cs_set_user_bpammo (id, g_EWeaponId, EWEAPON_START_AMMO);
  656. }
  657. }
  658.  
  659. public zp_user_infected_post(id) {
  660. if (g_EWepPlayerData[id][wep_have] == true) {
  661. CWeapon__RemoveFromPlayer(id)
  662. }
  663. }
  664.  
  665. public zp_user_humanized_post(id, survivor) {
  666. if (survivor && g_EWepPlayerData[id][wep_have] == true) {
  667. CWeapon__RemoveFromPlayer(id)
  668. }
  669. }
  670.  
  671. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  672.   *{\\ rtf1\\ ansi\\ ansicpg1250\\ deff0\\ deflang1051{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
  673.   */


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: CSO Dual Balrog segítség
HozzászólásElküldve: 2013.04.05. 17:39 
Offline
Őstag

Csatlakozott: 2013.01.27. 17:48
Hozzászólások: 1247
Megköszönt másnak: 6 alkalommal
Megköszönték neki: 61 alkalommal
khm..
pocok5 írta:
Egyedi Left 4 Dead mod

_________________
banned user


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: CSO Dual Balrog segítség
HozzászólásElküldve: 2013.04.05. 22:09 
Offline
Veterán
Avatar

Csatlakozott: 2011.11.17. 15:48
Hozzászólások: 1904
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 54 alkalommal
Nem megy , be fagy a szerver.


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 40 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole