Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.82 KB | None | 0 0
  1. // D2LoD Forwards
  2.  
  3. // Player has been spawned
  4. public fwd_PlayerSpawn(id)
  5. {
  6. if ( !is_user_alive(id) )
  7. return;
  8.  
  9. Set_Custom_Model(id);
  10.  
  11. if( g_iFakeplayer == id )
  12. {
  13. set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
  14. set_pev( id, pev_solid, SOLID_NOT );
  15. entity_set_origin( id, Float:{ 999999.0, 999999.0, 999999.0 } );
  16. dllfunc( DLLFunc_Think, id );
  17. }
  18. else
  19. {
  20. set_task( 0.2, "Hide_Hud", id);
  21.  
  22. if ( get_pcvar_num(d2_3rdperson) )
  23. {
  24. Create_PlayerCamera( id );
  25. }
  26.  
  27. remove_task( id + TASKID_FIRSTCONNECT);
  28. remove_task( id + TASKID_MANAREGEN);
  29.  
  30. g_Armor[id] = (HEROES_DEFENCE_DEXTERITY[g_PlayerHero[id][g_CurrentChar[id]]] * g_Dexterity[id][g_CurrentChar[id]]);
  31.  
  32. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  33. {
  34. Set_Player_Armor_Item(id, item_id)
  35. }
  36.  
  37. if( get_pcvar_num(d2_spawn_protection) )
  38. {
  39. g_PlayerProtected[id] = true;
  40.  
  41. set_task(get_pcvar_float(d2_spawn_protection_time), "Remove_Spawn_Protection", id);
  42. }
  43.  
  44. if ( g_Player_FirstTime_Connected[id] )
  45. {
  46. g_Player_FirstTime_Connected[id] = false;
  47. }
  48.  
  49. strip_user_weapons(id);
  50. give_item(id, "weapon_knife");
  51.  
  52. set_task(HEROES_REGAIN_MANA[g_PlayerHero[id][g_CurrentChar[id]]], "Mana_Regenerate", id + TASKID_MANAREGEN, _, _, "b");
  53.  
  54. g_MaxHealth[id] = 100 + (HEROES_VITALITY_PERSTAT[g_PlayerHero[id][g_CurrentChar[id]]] * g_Vitality[id][g_CurrentChar[id]]);
  55.  
  56. set_user_health( id, g_MaxHealth[id] );
  57. }
  58. }
  59.  
  60. // Player damaged
  61. public fwd_PlayerDamaged(victim, inflictor, attacker, Float:damage, damagebits)
  62. {
  63. if ( attacker == victim || !(1 <= attacker <= g_iMaxPlayers) )
  64. return HAM_IGNORED;
  65.  
  66. new Float: counted_damage;
  67. new Float: counted_item_damage;
  68.  
  69. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  70. {
  71. if ( g_iPlayerItemWorn[attacker][g_CurrentChar[attacker]][item_id] && g_iPlayerItem[attacker][g_CurrentChar[attacker]][item_id] > 0
  72. && g_PlayerLevel[attacker][g_CurrentChar[attacker]] >= item_data[item_id][CHAR_LEVEL]
  73. && g_Strength[attacker][g_CurrentChar[attacker]] >= item_data[item_id][CHAR_STR] && g_Dexterity[attacker][g_CurrentChar[attacker]] >= item_data[item_id][CHAR_DEX] && float(item_data[item_id][CHAR_DAMAGE]) > 0.0 )
  74. {
  75. counted_item_damage += float(item_data[item_id][CHAR_DAMAGE]);
  76. }
  77. }
  78.  
  79. new iArmor = g_Armor[victim];
  80. counted_damage = ((HEROES_STRENGTH_PERSTAT[g_PlayerHero[attacker][g_CurrentChar[attacker]]] * g_Strength[attacker][g_CurrentChar[attacker]]) + damage + counted_item_damage);
  81. new Float:counted_defence = (iArmor > 0 ? (iArmor / counted_damage) * 5.0 : 0.0);
  82. counted_damage = counted_damage - counted_defence;
  83.  
  84. new Float:totally_counted;
  85. totally_counted = (counted_damage < 7.0 ? 7.0 : counted_damage );
  86.  
  87. new Float:iArray[1]; iArray[0] = totally_counted;
  88. new iArrayPass = PrepareArray( _:iArray, sizeof(iArray), 1)
  89.  
  90. ExecuteForward( g_TakeDamage, g_iReturn, victim, attacker, iArrayPass);
  91.  
  92. if ( get_pcvar_num(d2_show_damage) && iArray[0] >= 1.0 )
  93. {
  94. // Just positioning HUD
  95. new iPos = ++g_iPlayerPosHUD[attacker]
  96. if( iPos == sizeof(g_flCoordsHUD) )
  97. {
  98. iPos = g_iPlayerPosHUD[attacker] = 0
  99. }
  100.  
  101. set_hudmessage(255, 255, 255, Float:g_flCoordsHUD[iPos][0], Float:g_flCoordsHUD[iPos][1], 0, 0.1, 2.0, 0.02, 0.02, -1)
  102. show_hudmessage(attacker, "+%d", floatround(iArray[0]));
  103. }
  104.  
  105. if ( get_pcvar_num(d2_show_damage_received) && iArray[0] >= 1.0 )
  106. {
  107. // Just positioning HUD
  108. new iPos = ++g_iPlayerPosHUD[victim]
  109. if( iPos == sizeof(g_flCoordsHUD) )
  110. {
  111. iPos = g_iPlayerPosHUD[victim] = 0
  112. }
  113.  
  114. set_hudmessage(255, 0, 0, Float:g_flCoordsHUD[iPos][0], Float:g_flCoordsHUD[iPos][1], 0, 0.1, 2.0, 0.02, 0.02, -1)
  115. show_hudmessage(victim, "-%d", floatround(iArray[0]));
  116. }
  117.  
  118. new iTeam = fm_get_user_team( victim )
  119.  
  120. if( iTeam == fm_get_user_team(attacker) )
  121. {
  122. fm_set_user_team( victim, iTeam == 1 ? 2 : 1 );
  123. ExecuteHam(Ham_TakeDamage, victim, inflictor, attacker, iArray[0], damagebits);
  124. fm_set_user_team(victim, iTeam );
  125. return HAM_HANDLED;
  126. }
  127. else
  128. {
  129. SetHamParamFloat(4, iArray[0] );
  130. return HAM_HANDLED;
  131. }
  132.  
  133. return HAM_IGNORED;
  134. }
  135. // Monster damaged by player
  136. public fwd_PlayerDamagedMonster(victim, inflictor, attacker, Float:damage, damagebits)
  137. {
  138. if ( !(1 <= attacker <= g_iMaxPlayers) )
  139. return HAM_IGNORED;
  140.  
  141. new Float:counted_strength;
  142. counted_strength = HEROES_STRENGTH_PERSTAT[g_PlayerHero[attacker][g_CurrentChar[attacker]]] * g_Strength[attacker][g_CurrentChar[attacker]];
  143. new Float: counted_damage;
  144. counted_damage = damage + counted_strength;
  145.  
  146. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  147. {
  148. if ( g_iPlayerItemWorn[attacker][g_CurrentChar[attacker]][item_id] && g_iPlayerItem[attacker][g_CurrentChar[attacker]][item_id] > 0
  149. && g_PlayerLevel[attacker][g_CurrentChar[attacker]] >= item_data[item_id][CHAR_LEVEL]
  150. && g_Strength[attacker][g_CurrentChar[attacker]] >= item_data[item_id][CHAR_STR] && g_Dexterity[attacker][g_CurrentChar[attacker]] >= item_data[item_id][CHAR_DEX] && float(item_data[item_id][CHAR_DAMAGE]) > 0.0 )
  151. {
  152. counted_damage += float(item_data[item_id][CHAR_DAMAGE]);
  153. }
  154. }
  155.  
  156. new Float:totally_counted;
  157. totally_counted = (counted_damage < 7.0 ? 7.0 : counted_damage );
  158.  
  159. new Float:iArray[1]; iArray[0] = totally_counted;
  160. new iArrayPass = PrepareArray( _:iArray, sizeof(iArray), 1)
  161.  
  162. if ( (1 <= victim <= g_iMaxPlayers) )
  163. {
  164. ExecuteForward( g_TakeDamage, g_iReturn, victim, attacker, iArrayPass);
  165. }
  166.  
  167. if ( get_pcvar_num(d2_show_damage) )
  168. {
  169. // Just positioning HUD
  170. new iPos = ++g_iPlayerPosHUD[attacker]
  171. if( iPos == sizeof(g_flCoordsHUD) )
  172. {
  173. iPos = g_iPlayerPosHUD[attacker] = 0
  174. }
  175.  
  176. set_hudmessage(255, 255, 255, Float:g_flCoordsHUD[iPos][0], Float:g_flCoordsHUD[iPos][1], 0, 0.1, 2.0, 0.02, 0.02, -1)
  177. show_hudmessage(attacker, "+%d", floatround(iArray[0]));
  178. }
  179.  
  180. SetHamParamFloat(4, iArray[0] );
  181.  
  182. return HAM_HANDLED;
  183. }
  184.  
  185. // Player damaged , something like this
  186. public fwd_TraceAttack(victim, attacker, Float:damage, Float:direction[3], traceresult, damagebits)
  187. {
  188. if ( attacker == victim || !(1 <= attacker <= g_iMaxPlayers) )
  189. return HAM_IGNORED;
  190.  
  191. if ( native_get_p_in_safezone(victim) )
  192. {
  193. return HAM_SUPERCEDE;
  194. }
  195. else if ( native_get_p_near_monster(victim) )
  196. {
  197. return HAM_SUPERCEDE;
  198. }
  199. else if ( native_is_p_protected(victim) )
  200. {
  201. return HAM_SUPERCEDE;
  202. }
  203. else
  204. {
  205. new Float:counted_dexterity, Float:block_value;
  206. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  207. {
  208. block_value += (g_iPlayerItemWorn[victim][g_CurrentChar[victim]][item_id] && g_iPlayerItem[victim][g_CurrentChar[victim]][item_id] > 0 && item_data[item_id][CHAR_BLOCK] > 0 ? item_data[item_id][CHAR_BLOCK] : 0)
  209. }
  210.  
  211. counted_dexterity = HEROES_DEXTERITY_PERSTAT[g_PlayerHero[victim][g_CurrentChar[victim]]] * g_Dexterity[victim][g_CurrentChar[victim]];
  212. new Param[2];
  213. Param[0] = attacker;
  214.  
  215. if ( random_num(0, get_pcvar_num(d2_max_random_value) ) < floatround(counted_dexterity + block_value) )
  216. {
  217. set_hudmessage(0, 150, 255, 0.05, 0.35, 1, 1.5, 1.5, 0.0, 0.0, 3)
  218. ShowSyncHudMsg(victim, g_SyncHudCreate_Avade , "Attack Evaded!" )
  219. ShowSyncHudMsg(attacker, g_SyncHudCreate_Avade , "Attack Missed!" )
  220.  
  221. return HAM_SUPERCEDE;
  222. }
  223. else
  224. {
  225. for(new item_id = 0; item_id <= g_charcounter ; item_id++)
  226. {
  227. if ( g_iPlayerItemWorn[attacker][g_CurrentChar[attacker]][item_id] && g_iPlayerItem[attacker][g_CurrentChar[attacker]][item_id] > 0 )
  228. {
  229. if ( item_data[item_id][CHAR_HASP] > 0 )
  230. {
  231. Param[1] = item_id;
  232.  
  233. set_user_rendering(victim, kRenderFxGlowShell, 0, 255, 0, kRenderTransAlpha, 100)
  234.  
  235. set_task( 1.0, "Start_poison_damage", victim + TASKID_POISON, Param, sizeof Param, "b");
  236. set_task( float(item_data[item_id][CHAR_PDURATION]), "End_poison_damage", victim);
  237. }
  238.  
  239. if ( item_data[item_id][CHAR_DURABILITY] > 0 )
  240. {
  241. Set_Player_Item_Repair(attacker, item_id, g_iPlayerItemRepair[attacker][g_CurrentChar[attacker]][item_id] - 1);
  242. }
  243. }
  244. }
  245.  
  246. new iTeam = fm_get_user_team( victim )
  247.  
  248. if( iTeam == fm_get_user_team(attacker) )
  249. {
  250. fm_set_user_team( victim, iTeam == 1 ? 2 : 1 );
  251. ExecuteHam(Ham_TraceAttack, victim, attacker, damage, direction, traceresult, damagebits)
  252. fm_set_user_team(victim, iTeam )
  253. return HAM_SUPERCEDE;
  254. }
  255. }
  256. }
  257.  
  258. return HAM_IGNORED;
  259. }
  260. // Player Killed Post
  261. public fwd_KilledPost(victim, attacker, shouldgib)
  262. {
  263. if ( attacker > g_iMaxPlayers && get_pdata_int( victim, m_bitsDamageType ) & DMG_CRUSH && pev( attacker, pev_dmg ) )
  264. {
  265. if( get_pcvar_num(d2_enable_respawn) )
  266. {
  267. set_task(get_pcvar_float(d2_spawn_cooldown), "Spawn_Player", victim);
  268. }
  269.  
  270. End_poison_damage(victim);
  271. }
  272. }
  273. // Player Killed
  274. public fwd_Killed(victim, attacker, shouldgib)
  275. {
  276. if ( attacker )
  277. {
  278. if ( attacker != victim && (1 <= attacker <= g_iMaxPlayers) )
  279. {
  280. Set_Data_Kill(victim, attacker)
  281.  
  282. new iTeam = fm_get_user_team( victim )
  283.  
  284. if( iTeam == fm_get_user_team(attacker) )
  285. {
  286. fm_set_user_team( victim, iTeam == 1 ? 2 : 1 );
  287. ExecuteHamB(Ham_Killed, victim, attacker, shouldgib)
  288. fm_set_user_team(victim,iTeam)
  289. }
  290. }
  291. }
  292.  
  293. if( get_pcvar_num(d2_enable_respawn) )
  294. {
  295. set_task(get_pcvar_float(d2_spawn_cooldown), "Spawn_Player", victim);
  296. }
  297.  
  298. End_poison_damage(victim);
  299.  
  300. return HAM_IGNORED;
  301. }
  302. public fwd_AttackSpeed ( const Entity )
  303. {
  304. if ( !pev_valid(Entity) || !get_pcvar_num(d2_block_attack2) ) return HAM_IGNORED;
  305.  
  306. set_pdata_float( Entity , m_flNextSecondaryAttack , 99999.0, 4 );
  307.  
  308. return HAM_IGNORED;
  309. }
  310.  
  311. public SetClientKeyValue(id, szInfoBuffer[], szKey[], szValue[])
  312. {
  313. if(g_szModel[id][0] && equal(szKey, "model") && !equal(szValue, g_szModel[id]))
  314. {
  315. set_user_info(id, "model", g_szModel[id])
  316. return FMRES_SUPERCEDE
  317. }
  318. return FMRES_IGNORED
  319. }
  320. public ClientUserInfoChanged(id)
  321. {
  322. new szOldName[32]
  323. pev(id, pev_netname, szOldName, charsmax(szOldName))
  324. if( szOldName[0] && is_user_connected(id) )
  325. {
  326. new szNewName[32]
  327. get_user_info(id, "name", szNewName, charsmax(szNewName))
  328. if( !equal(szOldName, szNewName) )
  329. {
  330. set_user_info(id, "name", szOldName);
  331. client_cmd( id, "name ^"%s^";setinfo name ^"%s^"", szOldName, szOldName )
  332. return FMRES_HANDLED;
  333.  
  334. }
  335. }
  336.  
  337. return FMRES_IGNORED;
  338. }
  339.  
  340. public fwd_CmdStart(client, uc_handle, seed)
  341. {
  342. if ( !is_user_alive(client) )
  343. return FMRES_IGNORED;
  344.  
  345. new button = get_uc(uc_handle, UC_Buttons);
  346. new oldbuttons = pev(client, pev_oldbuttons);
  347.  
  348. static ent, body;
  349. new Float:aim_distance = get_user_aiming(client, ent, body);
  350. new Param[1];
  351. new model[33];
  352. pev(client, pev_viewmodel2, model, 32);
  353.  
  354. if ( PRESSED( IN_ATTACK2 ) && !g_FreezeTime && !g_Shooting[client])
  355. {
  356. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  357. {
  358. if ( Player_WItemDataActive(client, CHAR_CROSSBOWDAMAGE) && g_iPlayerItemBolts[client][g_CurrentChar[client]][item_id] > 0 && Player_WItemType(client, TYPE_BOLTS) )
  359. {
  360. Param[0] = item_id;
  361.  
  362. g_Shooting[client] = true;
  363.  
  364. //engclient_cmd(client, "weapon_knife");
  365. entity_set_string(client, EV_SZ_viewmodel, g_v_crossbow);
  366. entity_set_string(client, EV_SZ_weaponmodel, g_p_crossbow);
  367.  
  368. fm_set_animation(client, 6)
  369. set_task(float(SHOOT_TIME), "act_shoot", client + TASKID_CROSSBOW, Param, sizeof Param);
  370. }
  371. }
  372. }
  373. else if ( RELEASED( IN_ATTACK2 ) )
  374. {
  375. g_Shooting[client] = false;
  376.  
  377. if (equali(model, g_v_crossbow))
  378. {
  379. //engclient_cmd(client, "weapon_knife");
  380. entity_set_string(client, EV_SZ_viewmodel, g_brassknuckles);
  381. entity_set_string(client, EV_SZ_weaponmodel, "");
  382.  
  383. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  384. {
  385. if ( g_iPlayerItemWorn[client][g_CurrentChar[client]][item_id] && item_data[item_id][CHAR_TYPE] == TYPE_WEAPON && g_iPlayerItem[client][g_CurrentChar[client]][item_id] > 0 )
  386. {
  387. if ( equal(item_vmodel[item_id], "models/", 7) )
  388. {
  389. entity_set_string(client, EV_SZ_viewmodel, item_vmodel[item_id]);
  390. }
  391. else
  392. {
  393. entity_set_string(client, EV_SZ_viewmodel, g_brassknuckles);
  394. }
  395.  
  396. if ( equal(item_pmodel[item_id], "models/", 7) )
  397. {
  398. entity_set_string(client, EV_SZ_weaponmodel, item_pmodel[item_id]);
  399. }
  400. else
  401. {
  402. entity_set_string(client, EV_SZ_weaponmodel, "");
  403. }
  404. }
  405. }
  406. }
  407.  
  408. remove_task(client + TASKID_CROSSBOW);
  409. }
  410.  
  411. if ( PRESSED( IN_USE ) && aim_distance <= DISTANCE_E_BUTTON_USE_ENT && !g_Shooting[client] )
  412. {
  413. if( pev_valid(ent) )
  414. {
  415. static classname[32];
  416. pev( ent, pev_classname, classname, charsmax(classname) );
  417.  
  418. if( equal(classname, "Inventory") )
  419. {
  420. main_inventory_menu(client)
  421. return FMRES_IGNORED;
  422. }
  423. else if ( equal(classname, "Charsi") )
  424. {
  425. main_charsi_menu(client);
  426. return FMRES_IGNORED;
  427. }
  428. else if ( equal(classname, "Akara") )
  429. {
  430. main_akara_menu(client)
  431. return FMRES_IGNORED;
  432. }
  433. }
  434. }
  435.  
  436. if ( PRESSED( IN_USE ) && !g_Shooting[client] )
  437. {
  438. main_hero_skill_menu(client);
  439. }
  440.  
  441. return FMRES_IGNORED;
  442. }
  443.  
  444. // Client Kill, 'kill' in console
  445. public fwd_ClientKill()
  446. {
  447. if ( get_pcvar_num(d2_block_kill_command) )
  448. return FMRES_SUPERCEDE;
  449.  
  450. return FMRES_IGNORED;
  451. }
  452.  
  453. // Block weapon pickup
  454. public Fwd_Touch(ent, id)
  455. {
  456. if ( is_user_alive(id) )
  457. return HAM_SUPERCEDE;
  458.  
  459. return HAM_IGNORED;
  460. }
  461.  
  462. // Fm_Spawn, remove entities
  463. public fwd_Remove_Ents(ent)
  464. {
  465. if( pev_valid(ent) )
  466. {
  467. static classname[32];
  468. pev(ent, pev_classname, classname, sizeof(classname) - 1);
  469.  
  470. for (new i = 0; i < sizeof g_Objective_Ents; ++i)
  471. {
  472. if( equal(classname, g_Objective_Ents[i]) )
  473. {
  474. engfunc(EngFunc_RemoveEntity, ent);
  475. return FMRES_SUPERCEDE;
  476. }
  477. }
  478. }
  479.  
  480. return FMRES_IGNORED;
  481. }
  482.  
  483. // Game Description
  484. public fwd_GameDescription()
  485. {
  486. if ( equal( mod_name, "") ) return FMRES_IGNORED;
  487.  
  488. forward_return(FMV_STRING, mod_name);
  489.  
  490. return FMRES_SUPERCEDE;
  491. }
  492.  
  493. // Get player's current speed
  494. public fwd_ItemGetMaxSpeed ( const WeapIndex )
  495. {
  496. if ( !pev_valid(WeapIndex) )
  497. return HAM_IGNORED;
  498.  
  499. new PlayerId = get_pdata_cbase( WeapIndex, 41, 4 );
  500. GetOrigHamReturnFloat( Current_Speed[ PlayerId ] );
  501.  
  502. return HAM_IGNORED;
  503. }
  504.  
  505. public D2_Item_Gone(id, item_id)
  506. {
  507. Take_Player_Armor_Item(id, item_id);
  508.  
  509. if ( item_data[item_id][CHAR_GIVEVIT] > 0 )
  510. {
  511. g_Vitality[id][g_CurrentChar[id]] -= item_data[item_id][CHAR_GIVEVIT];
  512. g_MaxHealth[id] -= (HEROES_VITALITY_PERSTAT[g_PlayerHero[id][g_CurrentChar[id]]] * item_data[item_id][CHAR_GIVEVIT]);
  513. }
  514.  
  515. if ( item_data[item_id][CHAR_GIVEENE] > 0 )
  516. {
  517. g_Energy[id][g_CurrentChar[id]] -= item_data[item_id][CHAR_GIVEENE];
  518. }
  519.  
  520. }
  521. public d2_skill_takedamage(victim, attacker, Float:iDamage[1])
  522. {
  523. if ( native_get_p_in_safezone(victim) || native_get_p_in_safezone(attacker) )
  524. iDamage[0] = 0.0;
  525.  
  526. if ( iDamage[0] > 0.0 )
  527. {
  528. if ( get_pcvar_num(d2_show_damage) )
  529. {
  530. // Just positioning HUD
  531. new iPos = ++g_iPlayerPosHUD[attacker]
  532. if( iPos == sizeof(g_flCoordsHUD) )
  533. {
  534. iPos = g_iPlayerPosHUD[attacker] = 0
  535. }
  536.  
  537. set_hudmessage(255, 255, 100, Float:g_flCoordsHUD[iPos][0], Float:g_flCoordsHUD[iPos][1], 0, 0.1, 2.0, 0.02, 0.02, -1)
  538. show_hudmessage(attacker, "+%d", floatround(iDamage[0]));
  539. }
  540.  
  541. if ( get_pcvar_num(d2_show_damage_received) )
  542. {
  543. // Just positioning HUD
  544. new iPos = ++g_iPlayerPosHUD[victim]
  545. if( iPos == sizeof(g_flCoordsHUD) )
  546. {
  547. iPos = g_iPlayerPosHUD[victim] = 0
  548. }
  549.  
  550. set_hudmessage(255, 50, 0, Float:g_flCoordsHUD[iPos][0], Float:g_flCoordsHUD[iPos][1], 0, 0.1, 2.0, 0.02, 0.02, -1)
  551. show_hudmessage(victim, "-%d", floatround(iDamage[0]));
  552. }
  553. }
  554. }
  555. public Entity_Touched(ent, victim)
  556. {
  557. if ( !pev_valid(ent) )
  558. return;
  559.  
  560. new classname[32]
  561. pev( ent, pev_classname, classname, 31)
  562.  
  563. new attacker = entity_get_edict(ent, EV_ENT_owner);
  564.  
  565. if ( equal(classname,"Crossbow") )
  566. {
  567. if ( is_user_alive(victim) && victim != attacker && !native_get_p_in_safezone(victim) && !g_PlayerProtected[victim] && is_user_alive(attacker) && !native_get_p_in_safezone(attacker)
  568. && !native_get_p_near_monster(victim) && !native_get_p_near_monster(attacker) )
  569. {
  570. for (new item_id = 0; item_id <= g_charcounter; item_id++)
  571. {
  572. if ( g_iPlayerItemWorn[attacker][g_CurrentChar[attacker]][item_id]
  573. && g_iPlayerItem[attacker][g_CurrentChar[attacker]][item_id] > 0 && item_data[item_id][CHAR_CROSSBOWDAMAGE] > 0 )
  574. {
  575. new Float:iArray[1]; iArray[0] = float(item_data[item_id][CHAR_CROSSBOWDAMAGE]);
  576. new iArrayPass = PrepareArray( _:iArray, sizeof(iArray), 1)
  577.  
  578. ExecuteForward( g_RangedDamage, g_iReturn, victim, attacker, iArrayPass);
  579.  
  580. Dmg_Kill_Player(victim, attacker, iArray[0], "ranged");
  581. }
  582. }
  583. }
  584.  
  585. set_pev( ent, pev_flags, FL_KILLME);
  586. }
  587.  
  588. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement